I'm developing a small application with needs to replace .NET style "variables" in strings with their values. An example is given below:
Replace:
"{D}/{MM}/{YYYY}"
With:
"31/12/2009"
I have decided to use Regex to find the occurrences of "{var}" but I'm not too sure how to properly go about it.
...
I have a text title that reads
This User "The Title Of The Post"
I want to grab just whats INSIDE of the quotation marks, and store it in a variable. How would i do this with regex and php?
...
I am not sure how to go about this. Right now I am counting the spaces to get the word count of my string but if there is a double space the word count will be inaccurate. Is there a better way to do this?
...
What is the best way to parse time from a string?
Example string: "this is 10:45 this is 10:48, 10:49, 10:50, 22:15";
Expected return:
[0] = 10:45
[1] = 10:48
[2] = 10:49
[3] = 10:50
[4] = 22:15
Thanks for any replies!!
...
Hi,
I am trying to match a string only if it is not part of an html tag.
For example when searching for the string: "abc".
<a href="foo.html">abc def</a> should match
<p> foo bar foo abc foo bar</p> should match
but
<a href="abc.html">foo</a> should not match.
Thanks for the help!
...
I need some help with some regular expression problems I am having. First off, double quotes ".
Anything between "" needs to be matched. Next problem I need to match anything that starts with a ' till the end of a line \n or <br />.
I've tried all sorts, but nothing seems to match it. Any ideas?
Sorry guys, just realised I need the qu...
I'm looking at the log messages for a particular branch in TortoiseSVN. We have an automated build process which has commits regularly to the branch using the author "builder".
In the TortoiseSVN search box, you can filter by authors and you can use regular expressions... what search expression can I use to show all the log messages no...
I need some help with regex:
I got a html output and I need to wrap all the registration trademarks with a <sup></sup>
I can not insert the <sup> tag in title and alt properties and obviously I don't need to wrap regs that are already superscripted.
The following regex matches text that is not part of a HTML tag:
(?<=^|>)[^><]+?(?=<|...
This relates to my previous question (which can be viewed here). I'd like to be able to remove the trailing slash from the URL so that it doesn't mess up certain areas of my site. The .htaccess code is here:
# -s = File Exists
RewriteCond %{REQUEST_FILENAME} -s [OR]
# -l = Is a SymLink
RewriteCond %{REQUEST_FILENAME} -l [OR]
# -d = Is a...
I want to clean an HTML page of its tags, using Ruby.
I have the raw HTML, and would like to define a list of tags, e.g. ['span', 'li', 'div'],
and create an array of regular expressions that I could run sequentially, so that I have
clean_text = raw.gsub(first_regex,' ').gsub(second_regex,' ')...
with two regular expressions per tag (...
I have a string, and I would like to find all greater-than characters that are not part of an HTML tag.
Ignoring CDATA, etc., this should be easy: find any ">" character that either has no "<" before it, or there is another ">" between them.
Here's the first attempted solution I came up with:
(?<=(^|>)[^<]*)>
I think this should lo...
Hey,
I need a regexp in PHP to find a the http-equiv="refresh" meta tag in a URL. What I need is the actual URL to follow. Now, as far as I know there are two valid ways to use this meta tag:
content="0; url=urlhere" http-equiv="refresh" /> and
http-equiv="refresh" content="0; url=urlhere"/>
Thanks!
...
Lets say I need to get a string inside some h1, h2, or h3 tags
/<[hH][1-3][^>]*>(.*?)<\/[hH][1-3]>/
This works great if the user decides to take a sane approach to headers:
<h1>My Header</h1>
but knowing my users, they want bold, italic, underlined h1's. And they have that coding quagmire tinyMCE to help them do it. TinyMCE would o...
I am looking for example code using YQL to handle a web server log file.
YQL table for Apache access logs asks "What about a table for Apache access logs?"
to which spullara replies:
If we add something like this it will likely be with a regex based line reader that you could then apply to apache logs.
later Paul Tarjan says:
...
The following regex finds text between substrings FTW and ODP.
/FTW(((?!FTW|ODP).)+)ODP+/
What does the (?!...) do?
...
I'm developing an application in .NET where the user can provide Regular Expressions that are afterwards used to validate input data.
I need a way to know if a regular expression is actually valid for the .net regex engine.
Thanks for any help
...
Hi all,
i have simple regular expression:
^123$
Matches are for example
123
1234
etc.
How can i exactly 123 as result without the 1234 (i'm not sure, if it's possible)?
...
Hay guys, i need help with a REGEX.
I have the got the value of an input box with this.
fileext = filename.split(".").reverse()[0];
I need to make sure this is a jpg, gif or png. Else throw an error.
Thanks
...
I have a UITextView where users can type text. I want to parse HTML Links (Domains with or without http://) and Phone Numbers from the users after they click on the button.
I know I can set the editable property of UITextView to NO to automatically parse links but I don't have the option to make it editable=NO and I want to parse the Li...
In an Oracle 10 database, I did a small test:
SELECT REGEXP_REPLACE('İF', '[Iİ]F', 'DONE', 1, 0, 'i') FROM dual;
This doe not seem to match the regex. However, when I remove the last parameter (case insensitive regex parameter), regex matches
SELECT REGEXP_REPLACE('İF', '[Iİ]F', 'DONE', 1, 0) FROM dual;
Below queries also returns "DO...