Hey guys, i'm really trying to understand regular expressions while scraping a site, i've been using it in my code enough to pull the following, but am stuck here. I need to quickly grab this:
http://www.example.com/online/store/TitleDetail?detail&sku=123456789
from this:
('<a href="javascript:if(handleDoubleClick(this.id)){windo...
<table >
<tr>
<td colspan="2" style="height: 14px">
tdtext1
<a>hyperlinktext1<a/>
</td>
</tr>
<tr>
<td>
tdtext2
</td>
<td>
<span>spantext1</span>
</td>
</tr>
</table>
This is my sample text how to write a regular expressi...
I'm using preg_* in PHP to search for the pattern <!-- %{data=THIS GETS MATCHED}% --> and pull out the matched text.
The pattern for this is:
preg_match('#<!-- %{' . $knownString . '\s*=\s*(.*?)}% -->#', ...)
What I would like it to do is search across multiple lines for the string. For example:
<!-- %{data=
THIS GETS
MATCHED AND
RE...
I'm trying to validate a USA mobile number, since I'm using pre-built javascript validation library I just replaced this regex validation with the previous one which comes with the validation library.
previous validation regex:
"telephone":{
"regex":"/^[0-9\-\(\)\ ]{10,10}$/",
"alertText":"* Invalid phone number"},
This works like 21...
Hi,
I've got two possible string inputs that my application will receive, and if it matches the following two strings, I need it regex.ismatch() to return true:
"User * has logged out"
"User * has joined"
I'm not that good at regex and just can't figure out how to go about matching the above.
Any help would be great!!!
...
I would like to use UltraEdit regular expression (perl) to replace the following text with some other text in a bunch of html files:
<style type="text/css">
#some-id{}
.some-class{}
//many other css styles follow
</style>
I tried to use <style type="text/css">.*</style> but of course it wouldn't match anything because the dot matc...
Regex to remove everything outside the { }
for example:
before:
|loader|1|2|3|4|5|6|7|8|9|{"data" : "some data" }
after:
{"data" : "some data" }
with @Marcelo's regex this works but not if there are others {} inside the {} like here:
"|loader|1|2|3|4|5|6|7|8|9|
{'data':
[
{'data':'some data'}
],
}"...
In RegEx, how would I select anything thats not in brackets:
E.g.
Xxxxxxx (01010101) would return Xxxxxxx ?
Thanks!
...
I've got a string:
doCall(valA, val.valB);
Using a regex in GVIM I would like to change this to:
valA = doCall(valA, val.valB);
How would I go about doing this? I use %s for basic regex search and replace in GVIM, but this a bit different from my normal usages.
Thanks
...
So, I have this url in a string:
http://www.domain.com/something/interesting_part/?somevars&othervars
in PHP, how I can get rid of all but "interesting_part"?
...
I'm looking to tokenize really simple strings,but struggling to get the right Regex.
The strings might look like this:
string1 = "{[Surname]}, some text... {[FirstName]}"
string2 = "{Item}foo.{Item2}bar"
And I want to extract the tokens in the curly braces (so string1 gets "{[Surname]}","{[FirstName]}" and string2 gets "{Item}" and ...
I've got a string of digits that is either 4 or 5 digits long and it needs to be padded with "0" till it's 6 digits long. Is this possible? I'm using .Net framework.
...
string time = "Job started: donderdag 6 mei 2010 at 20:00:02"
var filterReg = new Regex(@".*:", RegexOptions.Compiled);
time = filterReg.Replace(time, String.Empty);
Is it possible to stop after the first occurence? so at the first ":".
...
I'm trying to run a regular expression in VBA code that uses Microsoft VBScript Regular Expressions 5.5 (should be the same as JavaScript regex)
regex: ^[0-9A-Z]?[0-9A-Z]{3}[A-Z]?([0-9A-Z]{6})-?([0-9])?$
input: X123A1234567
match: 123456
The six characters I'm interested in give a good match of 123456, ignoring the last (check) digit. ...
Edit: OK, I can't read, thanks to Col. Shrapnel for the help. If anyone comes here looking for the same thing to be answered...
print_r(preg_split('/([\!|\?|\.|\!\?])/', $string, null, PREG_SPLIT_DELIM_CAPTURE));
Is there any way to split a string on a set of delimiters, and retain the position and character(s) of the delimiter after th...
Hi, if I have a input with new lines in it like:
[INFO]
xyz
[INFO]
How can I pull out the xyz part using $ anchors? I tried a pattern like /^\[INFO\]$(.*?)$\[INFO\]/ms, but perl gives me:
Use of uninitialized value $\ in regexp compilation at scripts\t.pl line 6.
Is there a way to shut off interpolation so the anchors work as expe...
Examples:
"1 name": Should say it has characters
"10,000": OK
"na123me": Should say it has characters
"na 123, 000": Should say it has characters
...
I have a list of keywords, about 25,000 of them. I would like people who add a certain < script> tag on their web page to have these keywords transformed into links. What would be the best way to go and achieve this?
I have tried the simple javascript approach (an array with lots of elements and regexping/replacing each) and it obviousl...
What is the regular expression for validating a month with the leading zero?
Passes regular expression:
01,02,03,04,05,06,07,08,09,10,11,12
Fails regular expression:
1, 00, 13 and up.
...
Hello,
I have a C# program where I am using a lot of RegEx.Replace to replace text in my text file.
Here is my problem.
In my text file, I have a code such as "M6T1". This code is listed in numerous places in the text file.
However, I only want to delete it from the bottom (last instance) in the text file. There will always be a "M...