I'm looking at a regular expression in our source code, and I'm unsure if it's correct.
<<SWE.[^<<]*>>
Specifically, what does the [^<<] part do? I thought the brackets allowed you to supply a range. Does it exclude "<<" or just a single "<" ?
If this was a line of text being parsed:
<<SWE.SomeText>><<SWE.SomeMoreText>>
I think t...
Hi,
I would like to extract portion of a text using a regular expression. So for example, I have an address and want to return just the number and streets and exclude the rest:
2222 Main at King Edward Vancouver BC CA
But the addresses varies in format most of the time. I tried using Lookbehind Regex and came out with this expression...
I'm trying to write a python regular expression that will match both these URLs:
http://www.waymarking.com/waymarks/WM6N3G_Battle_Mountain_State_Park
http://www.waymarking.com/waymarks/WM6N3G
and for both will capture:
http://www.waymarking.com/waymarks/WM6N3G
This is what I have:
(http://www.waymarking.com/waymarks/.*?)_?.*?
Bu...
This is simple,
but I am taking an entire directory listing (in PHP with dir()), and making sure it both:
isn't "." or "..", and
ends in a file extension .jpg, .jpeg, .gif, or .png.
Right now I have
function isValidFile($filename) {
$dirDotExpr = "/^\.{1,2}$/"; //matches against "." and ".."
$extExpr = "/\.(jpg|jpeg|gif|png)...
Hi,
I need to remove the following format from the end of a string in javascript
1234, Australia
And only at the end of a string.
How would I do this?
...
Can anyone help me convert the following string ("D/6, 3RD FLOOR B- WING HANS CO-OPERATIVE SOCIETY DAWOOD BAGH J.P. ROAD CROSS ANDHERI WEST MUMBAI-400058") into the below string with (,) to start with new line using C# and asp .net.
D/6, 3RD FLOOR B- WING,
HANS CO-OPERATIVE SOCIETY,
DAWOOD BAGH,
J.P. ROAD CROSS,
ANDHERI WEST,
MUMBAI-40...
I am attempting to clean up some dodgy xml attributes with Regular expressions.
My input string is this
<TD X:NUM class=xl101P24_2>I Want to send a FAX:but not </TD>
My intended output string is this
<TD class=xl101P24_2>I Want to send a FAX:but not </TD>
My code now looks like this
public static Regex regex1 = new Regex(
"...
I'm trying to match chunks of JS code and extract string literals that contain a given keyword using Java.
After trying to come up with my own regexp to do this, I ended up modifying this generalized string-literal matching regexp (Pattern.COMMENTS used when building the patterns in Java):
(["'])
(?:\\?+.)*?
\1
to the following
([...
I have the following regular expression in a asp.net email test box:
([a-zA-Z0-9_\-\.]+)\@((base\.co\.uk)|(base\.com)|(group\.com)|(arg\.co\.uk)|(arggroup\.com))
This regular expression only works for
[email protected]
[email protected]
[email protected]
It's not working for:
[email protected]
[email protected]
Please help me
...
I came across the following regular expression below on one of my code, anyone care enough to help me explain what it does?
(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\...
Posting a video on tumblr.com allows you to just paste the URL of the video on youtube, vimeo, whatever and tumblr automatically does the embedding for you.
I assume that this would be nothing more than a mapping between an URL-regex and the belonging HTML construct for embedding the video. Or it is just parsing the response of the URL ...
I'm progamming in javascript/jQuery.
Say, I have an array with includes a few number [1, 4, 5] and a string "theword".
I want to turn that string into "t<b>h</b>ew<b>or</b>d".
What is the best way to do this with RegEx?
...
I have an ASP.NET website with a regular expression validator text box.
I have changed the expression in the regular expression validation property "validator expression" and after compiling (rebuild) and running, the validation CHANGEs are not reflecting.
The previous validation is working fine but the changed validation is not workin...
I've never really done much with parsing text in PHP (or any language). I've got this text:
1 (2) ,Yes,5823,"Some Name
801-555-5555",EXEC,,"Mar 16, 2009",0.00,
1 (3) ,,4821,Somebody Else,MBR,,"Mar 11, 2009",,0.00
2 (1) ,,5634,Another Guy,ASSOC,,"Mar 15, 2009",,0.00
You can see the first line has a break, I need to get it be:
1 (2) ,...
I need a regular expression for a text field in my asp.net website
which should lie in between
0000 to 9999
it is not be
0 to 9999
...
I have just read this interesting article about the implementation details for various languages that support regular expressions.
It describes an alternative implementation of regular expressions that uses non-deterministic finite automatons (NFAs) versus deterministic ones (DFAs). It claims that back-tracking DFA implementations (t...
I must admit it's been a few years since my RegEx class and since then, I have done little with them. So I turn to the brain power of SO. . .
I have an Excel spreadsheet (2007) with some data. I want to search one of the columns for a pattern (here's the RegEx part). When I find a match I want to copy a portion of the found match to an...
I want to use PHP to replace javascript functions in HTML documents. For example:
original:
function my_function(hey) {
do stuff
}
new:
function new_function(hi) {
do different stuff
}
I was thinking of using regular expressions with the ereg_replace function, but I'm not sure if this is the best approach. The code in each...
I am looking to match some standard strings like dates, SSN, IP addresses etc. Is there a free online repository of regular expressions to match some of these commonly used strings?
...
Hello,
how do I convert some text to a link? Back in PHP, I used this piece of code that worked well for my purpose:
$text = preg_replace("#(^|[\n ])(([\w]+?://[\w\#$%&~.\-;:=,?@\[\]+]*)(/[\w\#$%&~/.\-;:=,?@\[\]+]*)?)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\3</a>", $text);
$text = preg_replace("#(^|[\n ])((...