What's the best way to extract the key and value from a string like this:
var myString = 'A1234=B1234';
I originally had something like this:
myString.split('=');
And that works fine, BUT an equal (=) sign could be used as a key or value within the string plus the string could have quotes, like this:
var myString = '"A123=1=2=3=4"...
I have a string. I need to replace all instances of a given array of strings from this original string - how would I do that?
Currently I am using...
var inputString = "this is my original string.";
var replacement = "";
var pattern = string.Join("|", arrayOfStringsToRemove);
Regex.Replace(inputString, pattern, replacement);
This wo...
I'm looking for a single line regex which does the following:
Given a HTML tag with the "name" attribute, I want to replace it with my own attribute. If that tag lacks the name attribute, I want to implant my own attribute. The result should look like this:
<IMG name="img1" ...> => <IMG name="myImg1" ...>
<IMG ...> => <IMG name="myImg1...
I'm fooling around with Yahoo! pipes and I'm hitting a wall with some regular expression. Now I'm familiar with regular expressions from Perl but the rules just seem to be different in Yahoo! pipes.
What I'm doing is fetching a page and trying to turn it into a feed, my regex for stripping out the link from the HTML works fine but the...
I have some unicode text that I want to clean up using regular expressions. For example I have cases where u'(2'. This exists because for formatting reasons the closing paren ends up in an adjacent html cell. My initial solution to this problem was to look ahead at the contents of the next cell and using a string function determine if...
Does VbScript have a native implementation for Regex? I need to validate e-mail addresses on an old ASP application.
Any pointers would be great.
...
Hi
I am trying to learn more about regular expressions I have one below that I believe finds cases where there is a missing close paren on a number up to 999 billion. The one below it I thought should do the same but I do not get similar results
missingParenReg=re.compile(r"^\([$]*[0-9]{1,3}[,]?[0-9]{0,3}[,]?[0-9]{0,3}[,]?[0-9]{0,3...
I have this input text:
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body><table cellspacing="0" cellpadding="0" border="0" align="center" width="603"> <tbody><tr> <td><table cellspacing="0" cellpadding="0" border="0" width="603"> <tbody><tr> <td width="314"><img height="61" ...
Hi,
I am having a very strange problem. I have a very large regular expression searching for certain words in some text (RegEx looks something like this: (?i)\b(a|b|c|d...)\b; and so on where a, b, c, d, represent words). Anyway, I put it in a pre compiled assembly to speed things up a bit, however the problem is that pre compiled regex...
hi,
I have been trying to remove the text before and after a particular character in each line of a text. It would be very hard to do manually since it contain 5000 lines and I need to remove text before that keyword in each line. Any software that could do it, would be great or any Perl scripts that could run on Windows. I run Perl scr...
I am trying to work out the overhead of the ASP.NET auto-naming of server controls. I have a page which contains 7,000 lines of HTML rendered from hundreds of nested ASP.NET controls, many of which have id / name attributes that are hundreds of characters in length.
What I would ideally like is something that would extract every HTML a...
Is there a regular expression that matches valid regular expressions?
(I know there are several flavors of regexps. One would do.)
...
So I have this regex:
(^(\s+)?(?P<NAME>(\w)(\d{7}))((01f\.foo)|(\.bar|\.goo\.moo\.roo))$|(^(\s+)?(?P<NAME2>R1_\d{6}_\d{6}_)((01f\.foo)|(\.bar|\.goo\.moo\.roo))$))
Now if I try and do a match against this:
B048661501f.foo
I get this error:
File "C:\Python25\lib\re.py", line 188, in compile
return _compile(pattern, flags)
...
Regex.IsMatch( "foo", "[\U00010000-\U0010FFFF]" )
Throws: System.ArgumentException: parsing "[-]" - [x-y] range in reverse order.
Looking at the hex values for \U00010000 and \U0010FFF I get: 0xd800 0xdc00 for the first character and 0xdbff 0xdfff for the second.
So I guess I have really have one problem. Why are the Unicode charact...
I wonder if there is a way to use ungreedy matching in JavaScript? I tried the U modifer, but it doesn't seem to work.
I want to write a small BBCode parser in JavaScript, but without ungreedy matching it isn't possible (at least as far as I see it) to do something like this:
'[b]one[/b] two [b]three[/b]'.replace( /\[b\](.*)\[\/b\]/, '...
Hello,
I posted this message to the Solr mailing list, but I'm trying here too in case there's a Solr expert lurking around.
I am trying to use the regex fragmenter and am having a hard time getting the results I want. I am trying to get fragments that start on a word character and end on punctuation, but for some reason the fragments ...
I want to search for a line in a file, using regex, inside a Perl script.
Assuming it is in a system with grep installed, is it better to:
call the external grep through an open() command
open() the file directly and use a while loop and an if ($line =~ m/regex/)?
...
I need to learn about RegEx? Does anyone know any good online resource for that.
Thanks!!
...
Everyday I receive thousands of emails and I want to parse the content/body of these emails to load them into a database.
My problem is that nowadays I am parsing the email body manually and I would like to change the logic to a Regular Expression in C#.
Here is the body of the emails:
Gentilissima Agenzia Nexity Residenziale
il no...
i have a string that looks like
"<input id=a/>"<input id=b/>"<input id=c/>etc.
I need to change it to
"<input id='a'/>"<input id='b'/>"<input id='c'/>etc,
any ideas how?
...