Hello,
The sad truth about this post is that I have poor regex skills. I recently came across some code in an old project that I seriously want to do something about. Here it is:
strDocument = strDocument.Replace("font size=""1""", "font size=0.2")
strDocument = strDocument.Replace("font size='1'", "font size=0.2")
strDocument = strD...
I have a string Action - [N]ew, [U]pdate, or [D]elete : N that I need to replace with "Action - [N]ew, [U]pdate, or [D]elete : U" somhow by using preg_replace I can't get it working. It remains the same.
My code looks like this
$action = Action - '[N]ew, [U]pdate, or [D]elete : U';
$line = preg_replace("/(Action - [N]ew, [U]pdate, or [...
Using Ruby, how can I use a single regex to match all occurrences of 'y' in "xy y ay xy +y" that are NOT preceded by x (y, ay, +y)?
/[^x]y/ matches the preceding character too, so I need an alternative...
...
I need to use a string to access nodes and attributes in XML using E4X. It would be ideal to have this scenario (with XML already loaded):
var myXML:XML = e.target.data;
var myStr:String = "appContent.bodyText.(@name == 'My Text')";
myXML.myStr = "New Value for bodyText node where attribute('name') is equal to 'My Text'";
I ultimate...
Hey guys, I have a regular expression that is pretty long, and is hard to look at.
i was wondering if you could help shorten it up, so it's more manageable.
I admit, I'm not a regexp guru, and I just hack away to get by. If you come up with something better (it doesn't even have to be shorter), please explain your reasoning, so I might h...
How are regular expressions processed?
...
I wanted to break a css file into an array with PHP.
Ex:
#selector{ display:block; width:100px; }
#selector a{ float:left; text-decoration:none; }
Into a php array...
array(2) {
["#selector"] => array(2) {
[0] => array(1) {
["display"] => string(5) "block"
}
[1] => array(1) {
["width"] => string(5) "100px"
...
I have the following code, which works, but I need to inject some different stuff into the regular expression object (regex2) at runtime. However, text.replace does not seem to like a string object for the regular expression, so how can I make this work?
var regex2 = /\|\d+:\d+/;
document.write("result = " + text.replace(regex2, '') + "...
I'm (finally) starting to learn regex, and I'm wondering if there's any notable difference between these two pattern strings. I'm trying to match lines such as "Title=Blah", and match "Title" and "Blah" in two groups.
The problem comes with titles like "Title=The = operator". Here are the two choices to solve the problem:
^([^=]+)=(.+)...
Related (but slightly different):
http://stackoverflow.com/questions/1181204/javascript-regex-surround-and-http-with-anchor-tags-in
I would like to surround all instances of @___, #____, and http://________ with anchor tags. Multiple passes is fine with me.
For example, consider this Twitter message:
The quick brown fox @Spreadt...
I am trying to find a way to let me dynamically create a regexp object from a string (taken from the database) and then use that to filter another string. This example is to extract data from a git commit message, but in theory any valid regexp could be present in the database as a string.
What happens
>> string = "[ALERT] Project: Rev...
When looking over the statistics for my site, I realized that the vast majority of traffic is coming via third party links to classic ASP pages which haven't existing for a few years now.
I decided that adding a bunch of urlMappings to the web.config wasn't a great idea, so I added Intelligencia UrlRewrite and tried to add a rule, as fo...
My first attempt using RE has me stuck. I'm using Regex on a Wordpress website via the Search-Regex Plugin and need to match on a specific " buried within a bunch of html code. HTML example:
provide brand-strengthening efforts for the 10-school conference.  </p>
<p>
<a href="http://www.learfield.com/oldblog/.a/6a00d8345233fa6...
Here is the demo String:
beforeValueAfter
Assume that I know the value I want is between "before" and "After"
I want to extact the "Value" using the regex....
pervious909078375639355544after
Assume that I know the value I want is between "pervious90907" and "55544after"
I want to extact the "83756393" using the regex....
thx...
I'm looking for a regex that will recognize # followed by a number in a string and make it clickable. Only if its # and a number like ex: #758 and make i clickable. Not # 758. Youtube has this for example.
Would really appreciate if someone could give me some hints since im worthless on regex.
...
I want to scan an excel sheet, and replace any occurrences of social security numbers with zeros... I would like to do this using Excel.Interop if at all possible, but I'm open to anything at this point... here's some of my code... I'm banging my head on the desk for the past few months...
// Get range and convert it to a string varia...
Hi!
I have a given DFA that represent a regular expression.
I want to match the DFA against an input stream and get all possible matches back, not only the lestmost-longest match.
For example:
regex: a*ba|baa
input: aaaaabaaababbabbbaa
result:
aaaaaba
aaba
ba
baa
Sorry for my English!
Thanks for your help!
...
I have content that is first htmlentities and then stripslashes followed by nl2br.
This means a watermark at the end ends up as:
<li><p><!-- watermark --></p></li>
Not very useful. I have the code below to try and strip the html comments and stop it displaying but its not very good at it!
$methodfinal = str_replace('<li><p><!--', '<...
Hi,
I want to use the following regular expression which is written within a C# .NET code, in a Java code, but I can't seem to convert it right, can you help me out?
Regex(@"\w+:\/\/(?<Domain>[\x21-\x22\x24-\x2E\x30-\x3A\x40-\x5A\x5F\x61-\x7A]+)(?<Relative>/?\S*)", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singlelin...
Hi There I were wondering if anyone can help me with a regex
I want to insert the following into a database:
(#text1#,#text2#,#text3#,#text4#,#text5#,#text6#, #text7#, #text8#, #text9#),
(#text1#,#text2#,#text3#,#text4#,#text5#,#text6#, #text7#, #text8#, #text9#),
(#text1#,#text2#,#text3#,#text4#,#text5#,#text6#, #text7#, #text8#, #te...