I have a RegExp like the following simplified example:
var exp = /he|hell/;
When I run it on a string it will give me the first match, fx:
var str = "hello world";
var match = exp.exec(str);
// match contains ["he"];
I want the first and longest possible match,
and by that i mean sorted by index, then length.
Since the expression ...
[^a-zA-Z] - matches anything except a,b,c,...z , A, B, ..Z
I want expression that matches anything except (abc) AND except (xyz)
I want a regex for image tag
I tried img.*src - it matches the initial part but between img and src there should not be any other image tag so I put a caret img[^(neither <img nor src=)] how to use ^ with a...
I was thinking in providing the following regex as an answer to this question, but I can't seem to write the regular expression I was looking for:
w?o?r?d?p?r?e?s?s?
This should match a ordered abbreviation of the word wordpress, but it can also match nothing at all.
How can I modify the above regex in order for it to match at least ...
Hi,
I am looking for a way to check if the "foo" word is present in a text file using C#.
I may use a regular expression but I'm not sure that is going to work if the word is splitted in two lines. I got the same issue with a streamreader that enumerates over the lines.
Any comments ?
...
(first time poster, long time visitor via Google)
I'm trying to extract the contents of some square brackets, however i'm having a spot of bother. I've got it working for round brackets as seen below, but I can't see how it should be modified to work for square brackets. I would have thought replacing the round for square and vice versa...
I am trying to search through the .htm files for our intranet to find out which network files are being linked to on which pages of the site. What I would like to do is have PowerShell go through each .htm and return any string that begins with "file:///" and ends with a double quote. For instance:
<td colspan="3"><a href="file:///X:/...
Hi!
I have string which contains something about "amount 3 val 6, amount 7 val 8" and so, what regular expression should I use to get array with corresponding amounts and values?
...
What I have is a config file with 100's of lines that has the following format:
Input line : FHF02030304|C:\sd\dad\qwe\re|{203-207}.TXT|5`
The format is : ID|Directory|Text|# txts
The formula for the additional lines is Text (in example 203) +1 -1.
so in the following example 203 +1 -1 = 203 (the first file)
203+2-1 = 204 (the 2nd ...
Hello,
How should like a regex which validates the name and surname, so that each word starts with a capital letter?
this does not work: @"[^A-Z]?[a-z]*"
Thanks
...
I'm looking for some ideas for the most efficient way to remove trailing html <br/> tags using javascript or jquery.
RULES:
The br, at the front and end must be removed.
It must remove non-closing and self-closing br tags.
All br within the textual content must remain untouched.
THE HTML:
<div class="generatedContent...
Hello,
I've read a few questions on here re parsing HTML with regex, and I understand that this is, on the whole, a terrible idea.
Having said this, I have a very specific problem that I think Regex might be the answer to. I've been fumbling around trying to work out the answer but I'm new (today) to Regex, and I was hoping some kind ...
I am using the LiveValidation library found at www.livevalidation.com to handle client-side validation. One of the functions is to test for a regular expression. The example they provide on the site is to check if the phrase 'live' is within the a sentence. The code for that is:
var f2 = new LiveValidation('f2');
f2.add( Validate.For...
Hi, I want to match the first number/word/string in quotation marks/list in the input with Regex. For example, it should match those:
"hello world" gdfigjfoj sogjds
-14.5 fdhdfdfi dfjgdlf
test14 hfghdf hjgfjd
(a (c b 7)) (3 4) "hi"
Any ideas to a regex or how can I start?
Thank you.
...
I have a string:
Apple1231|C:\asfae\drqw\qwer|2342|1.txt
I have the following code:
Regex line2parse = Regex.Match(line,@"(\|)(\|)(\|)(\d)");
if (line2parse < 2)
{
File.AppendAllText(workingdirform2 + "configuration.txt",
What I want to be able to do is replace every | after the first | with \
So i want to write out
...
I have one location match that correctly works:
<LocationMatch "^/user/storage/subaccounts(/[a-zA-Z0-9]+)?/?$">
this correctly forwards for something like
/user/storage/subaccounts/exampleuser
or
/user/storage/subaccounts/
I'd like to setup a locationmatch for
/user/storage/subaccounts/exampleuser/admin
My attempt at this was:
<Loc...
While searching for a solution to a python regular expression problem I found this page which demonstrates that [some version of] perl allows variables within regular expressions.
e.g. a perl regex something like:
^(?{ local $d=0}\((?{ $d++ }.*?\)(?d--)
Where variable $d is incremented and decremented depending on which part of the ...
I need to determine whether a phone number is valid before attempting to dial it. The phone call can go anywhere in the world.
What regular expression will match valid international phone numbers?
...
Hi all,
I need to validate shipping container numbers. There is an industry standard that says only alpha-numeric and 11 characters in length is acceptable. eg: FBXU8891735
However there is also a standard industry practice where the first 4 characters can be forward-slashes eg: ////8891735
I have 2 requirements - firstly to validate ...
I have a csv file with the data like this
Zoos, Sanctuaries & Animal Parks,7469,3.00
Unfortunately this is not correct as the first section should be all one field like this
"Zoos, Sanctuaries & Animal Parks","7469","3.00"
As this is just a once off import I would be just happy to transform it to
Zoos, Sanctuaries & Animal Parks|7...
I need the to convert the input address to specified format
#!/usr/bin/perl
my $file_path ="\\\abc.com\a\t\temp\L\\";
#---- Help in this regex
$file_path =~ s//\//\/gi;
#---- Output format needed
#$file_path ="\\abc.com\a\t\temp\L\";
printf $file_path;
...