Hi,
I am trying to do this regex match and replace but not able to do it.
Example
<SPAN class="one">first content here</SPAN>
<SPAN class="two">second content here </SPAN>
<SPAN class="three">one; two; three; and more.</span>
<SPAN class="four">more content here.</span>
I want to find each set of the span tags and replace with somet...
Specifically, I'm using the Linux command:
$ find . -regextype posix-extended -regex '<some regex>' ...
I just want to make sure the POSIX type I'm using is the type Perl uses, since that is by far the one I am most familiar with.
...
I need a regex expert to help out on this one. Examples I've found on here and the net I cant seem to get right. I'm using PHP and I have the following regex expression
/([^a-zA-Z0-9])GC([A-Z0-9]+)/
This matches items like GCABCD GC123A, etc. What i need to do is EXCLUDE GCSTATS from this. So basically I want it to work just as it...
If I want to get the length of each match within the parentheses in the following regex, how do I do it?:
^\(\-\+\s\)\+
I'm trying to modify the width of columns in a buffer with data that is laid out as a table. Since the first two rows of the table will look like this
DESIGN_ID DESIGN_YEAR SOURCE_REFERENCE
---------- ----------- ...
So, I basically would like to test to see if a string contains a range of alphanumeric characters. It's to be used as a client-side validation and I don't want to prevent users from entering whatever they want. Best to give examples of what should/should not pass validation:
So to be specific, the expression I'm looking for is to test t...
For example, these are valid math expressions:
a * b + c
-a * (b / 1.50)
(apple + (-0.5)) * (boy - 1)
And these are invalid math expressions:
--a *+ b @ 1.5.0 // two consecutive signs, two consecutive operators, invalid operator, invalid number
-a * b + 1) // unmatched parentheses
a) * (b + c) / (d // unmatched parentheses
I hav...
I want to return matches from a regular expression string. The regex string is:
(?<TICKER>[A-Z]+)(?<SPACE>\\s)(?<MONTH_ALPHA_ABBREV>Jan|Feb|Mar|Apr|May|Jun|Jul|Sep|Oct|Nov|Dec)(?<SPACE>\\s)(?<DAY>\\d+)(?<SPACE>\\s)(?<YEAR_LONG>[2][0][0-9][0-9])(?<SPACE>\\s)(?<STRIKE_DOLLAR>\\d+(?=[.]))[.](?<STRIKE_DECIMAL>(?<=[.])\\d+)(?<SPACE>\\s)(?<PU...
Background:
I'm trying to come up with a regex for a rewrite rule that will take anything that does not start with a particular prefix, and add that prefix to it. But urls that already have the prefix should be rejected by the regular expression (because they already have the url).
Example:
If the prefix is s1 a string like home will...
I have the following string:
<img alt="over 40 world famous brandedWATCHES BRANDs to choose from
" src="http://www.fastblings.com/images/logo.jpg"></strong></a><br>
I want to define a regex pattern like <img alt="(.+?)" src="http://(.+?).(jpg|gif)">, but as you can see the target string has a linebreak in the a...
I'm trying to split a string on newline characters (catering for Windows, OS X, and Unix text file newline characters). If there are any succession of these, I want to split on that too and not include any in the result.
So, for when splitting the following:
"Foo\r\n\r\nDouble Windows\r\rDouble OS X\n\nDouble Unix\r\nWindows\rOS X\nUni...
Hi,
I want to remove a part from a text till the given string, and remove another part starting from another string in php.
/.+string/i and /anotherstring.+/i didn't work.
...
Let's say I have two strings like this:
XABY
XBAY
A simple regex that matches both would go like this:
X(AB|BA)Y
However, I have a case where A and B are complicated strings, and I'm looking for a way to avoid having to specify each of them twice (on each side of the |). Is there a way to do this (that presumably is simpler than h...
Update: As per comments regarding the ambiguity of my question, I've increased the detail in the question.
(Terminology: by words I am refering to any succession of alphanumerical characters.)
I'm looking for a regex to match the following, verbatim:
Words.
Words with one apostrophe at the beginning.
Words with any number of non-con...
I am sending mails (in asp.net ,c#), having a template in text file (.txt) like below
User Name :<User Name>
Address : <Address>.
I used to replace the words within the angle brackets in the text file using the below code
StreamReader sr;
sr = File.OpenText(HttpContext.Current.Server.MapPath(txt));
copy = sr.ReadToEnd();
sr.Close(...
Example URLs
http://www.youtube.com/user/Scobleizer#p/u/1/1p3vcRhsYGo
http://www.youtube.com/watch?v=cKZDdG9FTKY&feature=channel
http://www.youtube.com/watch?v=yZ-K7nCVnBI&playnext_from=TL&videos=osPknwzXEas&feature=sub
http://www.youtube.com/ytscreeningroom?v=NRHVzbJVx8I
Any regex that will pull the correct YID from a...
This is for make something similar to "templates" in MediaWiki with PHP in order to make the parameters between nested templates work.
Is possible with a regex to capture all occurrences of a character between braces but ignoring occurrences of it if it occurs in a nested group of braces?
| {{ | {{ | }} | | }} |
Highlighted:
| {{ *|...
I have:
NSString *promise = @"thereAreOtherWorldsThanThese";
which I'm trying to transform into the string:
@"There are other worlds than these"
I'm guessing this is a regex job, but I'm very new to Objective C, and have so far had no luck. I would greatly appreciate any help!
...
I have a log file containing statistics from different servers. I am separating the statistics from this log file using regex only.
I am trying to capture the CPU usage from the running process. For SunOS, I have below output:
process,10050,user1,218,59,0,1271M,1260M,sleep,58.9H,0.02%,java
Here the CPU % is at 11th field if we separa...
I need to re-format a list of UK postcodes and have started with the following to strip whitespace and capitalize:
postcode.upcase.gsub(/\s/,'')
I now need to change the postcode so the new postcode will be in a format that will match the following regexp:
^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-...
I want a regular expression to validate a nickname: 6 to 36 characters, it should contain at least one letter. Other allowed characters: 0-9 and underscores.
This is what I have now:
if(!preg_match('/^.*(?=\d{0,})(?=[a-zA-Z]{1,})(?=[a-zA-Z0-9_]{6,36}).*$/i', $value)){
echo 'bad';
}
else{
echo 'good';
}
This seems to work, but when...