I've got a situation where I want to get a regexp from the user and run it against a few thousand input strings. In the manual I found that the RegExp object has a .compile() method which is used to speed things up ins such cases. But why do I have to pass the regexp string to it again if I already passed them in the constructor? Perhaps...
Can someone help me build a regular expression to validate time?
Valid values would be from 0:00 to 23:59.
When the time is less than 10:00 it should also support one character numbers
ie: these are valid values:
9:00
09:00
Thanks
...
I am trying to wrap my head around using regular expressions and replace() with JavaScript, but have not yet been successful
Suppose I have a string containing this:
<img alt="a picture of ..." src="image/1533?foo=1&bar=2$zot=3" width="500" />
If zot=3 I want remove foo (and its value) (or replace foo=x with an empty string).
The re...
I'm studying for a Discrete Mathematics test and I found this exercise which I can't figure out.
"Build a basic finite automaton (DFA,NFA,NFA-lambda) for the language in the alphabet Sigma = {0,1,2} where the sum of the elements in the string is even AND this sum is more than 3"
I have tried using Kleene's Theorem concatenating two lan...
Hello,
I am trying to create a regular expression pattern in C#. The pattern can only allow for:
letters
numbers
underscores
So far I am having little luck (i'm not good at RegEx). Here is what I have tried thus far:
// Create the regular expression
string pattern = @"\w+_";
Regex regex = new Regex(pattern);
// Compare a string a...
I need to parse a configuration file which looks like this (simplified):
<config>
<links>
<link name="Link1" id="1">
<encapsulation>
<mode>ipsec</mode>
</encapsulation>
</link>
<link name="Link2" id="2">
<encapsulation>
<mode>udp</mode>
</encapsulation>
</link>
</links>
My goal is to be able to change parameters specific to a ...
Hello!
We are using a RegEx Validator to validate an input from a textbox.
The current RegEx expression checks if the current number is between the range of 1 - 999.
We just inherited this code and we need to change the range from 999 to just 365. In short, we need to write a regex to check if the input is between 1 - 365.
Of course,...
Hi,
I have many links in my page.
For example <a href="/promotions/download/schools/australia.aspx">Australia</a>
Now I want only the href with its value i.e (href="/promotions/download/schools/australia.aspx") with vbscript regular expression.
...
Are Regular Expressions a must for doing programming?
...
G'day,
I am using the following Perl fragment to extract output from a Solaris cluster command.
open(CL,"$clrg status |");
my @clrg= grep /^[[:lower:][:space:]]+/,<CL>;
close(CL);
I get the following when I print the content of the elements of the array @clrg BTW "=>" and "<=" line delimiters are inserted by my print statement:
=><=...
I'm parsing an file, and parts of it is a records thing, the format is like:
CategoryA--
5: UserA
6: UserB
7: UserC
CategoryB--
4: UserA
5: UserB
I want to move it to a hash that looks like:
{ UserA => { CategoryA => 5, CategoryB => 4, },
UserB => { CategoryA => 6, CategoryB => 5, },
UserC => { CategoryA => 7, },
}
How do I do...
Hi,
I am having trouble fabricating a Regex which will returns tags that are not self-closing. So I would want it to returns tags which are like so:
<blah>
But not tags which are like:
<blah/>
I have the following regex:
<(o|p)(.*?)>
Which is slightly simplified, ignore the rest it does what it is meant to do despite it's oddn...
I'm relatively new to Unix shell scripting. Here's my problem. I've used this script...
isql -S$server -D$database -U$userID -P$password << EOF > $test
exec MY_STORED_PROC
go
EOF
echo $test
To generate this result...
Msg 257, Level 16, State 1:
Server 'MY_SERVER', Procedure 'MY_STORED_PROC':
Implicit conversion from datatype 'VARCHA...
Although this seems like a trivial question, I am quite sure it is not :)
I need to validate names and surnames of people from all over the world. How can I do that with a regular expression? If it were only English ones I think that this would cut it:
^[a-z -']+$
However, I need to support also these cases:
other punctuation symbo...
Long story short, I have two regex patterns. One pattern matches things that I want to replace, and the other pattern matches a special case of those patterns that should not be replace. For a simple example, imagine that the first one is "\{.*\}" and the second one is "\{\{.*\}\}". Then "{this}" should be replaced, but "{{this}}" should...
Hello,
I'm trying to get a link text using regex. there are possibly several links that may match the pattern and I want to get the furthest one until the 4th. Here is my JS code:
var level=1;
while ( _match = /<a href="http:\/\/www.mysite.com\/x\/(?:.*)>(.*)<\/a>/img.exec(_html)){
if (level < 5) (_anchor_text=_match[1]);
leve...
I'm using AWStats and I want to ignore everything in a subdirectory except for a particular directory, here is the directory layout:
Webroot
-dir_1
-dir_2
--subdir_a
--subdir_b
--subdir_c
...
I want to run statistics for everything in the web root excluding dir2 and all its subdirectories but including subdir b. I've tried usin...
I would like to intercept string
starting with *#*
followed by a number between 0 and 7
and ending with: ##
so something like *#*0##
but I could not find a regex for this
...
Hello,
I have a string of that displays like this....
1235, 3, 1343, 5, 1234, 1
I need to replace every second comma with a semicolon
i.e.
1235, 3; 1343, 5; 1234, 1
the string length will always be different but will follow the same pattern as the above i.e. digits comma space digits comma space, etc.
how can I do this with javas...
Im just learning mod_rewrite and regex stuff, and what I'm trying to do is pass variables of any name, with any number of variables and values, into a script and have them forwarded to a different script.
here is what I have so far:
RewriteEngine on
RewriteRule ^script\$(.*[\])? anotherscript?ip=%{REMOTE_ADDR}&$1 [L]
That all seems ...