I have an ASP.NET RegularExpressionValidator that checks file extensions. Is there a quick way I can tell it to ignore the case of the extension without having to explicitly add the upper case variants to my validation expression?
ValidationExpression="([^.]+[.](jpg|jpeg|gif|png|wpf|doc|docx|xls|xlsx ...
...
I've got a book on python recently and it's got a chapter on Regex, there's a section of code which I can't really understand. Can someone explain exactly what's going on here (this section is on Regex groups)?
>>> my_regex = r'(?P<zip>Zip:\s*\d\d\d\d\d)\s*(State:\s*\w\w)'
>>> addrs = "Zip: 10010 State: NY"
>>> y = re.search(my_regex, a...
I need to parse a string, such as
/a/b/c/d=uno/c=duo.html
into three groups, such as
/a/b/c/
d=uno/
c=duo.html
The parsing rules are:
The first group is everything until "d=" or the whole string if "d=" is not a part of the string.
The second group is everything until "c=" or the rest of the string following the first group if "c=...
Hi
I have a CMS with a WYSIWYG editor which produces pretty good xhtml. Based on this fact, I think a HTML parser might be slightly overkill for this small job.
I am intending to use regular expressions but so far have been unable to get mine to match what I'm after.
I'm using PHP5.
I need to match the content of the 3 block level el...
Lets Say we have Zaptoit:685158:[email protected]
How do you split so it only be left 685158:[email protected]
...
I want to do the following with regular expressions but not sure how to do it. I want it to match "one two" when one two is the beginning of the line unless the string contains "three" anywhere after "one two". Note the " marks are just to represent string literals I don't need to match on them.
...
Hi, I've written a DFA on paper, and want to translate it into a set of regular expressions. Does anybody know a good tool to do this?
...
I want to find all if statements and for statements which are not followed by curly brackets '{'. When you write a single line in an if statement you do not mostly enclose it in curly brackets, so I want to find all those if and for statements.
Please help!
Like I want to capture this statement
if (childNode.Name == "B")
return To...
I want greasemonkey to scan through a website and change certain words to something else. Is there a way to do it with regex or some other string processing function in javascript?
Thanks for your help :)
...
Hi,
I'm having difficulty throwing away the bits of the expression I don't want, and keeping the bits I do.
The problem is - given the input string:
{if cond}foo{else}bar{/if}
I'd like just to have:
0: {if cond}foo{else}bar{/if}
1: cond
2: foo
3: bar
And for the input string:
{if cond}foo{/if}
I'd like just to have:
0: {if co...
I've run into the following case a few times and I was wondering if there is a fast way to handle it in Vim.
I'll have a source file like the following:
#ifndef _FOO_H_
#define _FOO_H_
class Foo {
Foo(int foo);
};
#endif
And I would like to convert it to the following:
#ifndef _BAR_H_
#define _BAR_H_
class Bar {
Bar(int ba...
I have a CMS that uses a syntax based on HTML comments to let the user insert flash video players, slideshows, and other 'hard' code that the user could not easily write.
The syntax for one FLV movies looks like this:
<!--PLAYER=filename.flv-->
I use this code:
$find_players = preg_match("/<!--PLAYER\=(.*)-->/si", $html_content, $mat...
Hi all,
I've found two libs to work with Regular Expression in Ansi C:
[Lightweight C++]
http://students.ceid.upatras.gr/~sxanth/lwc/
This is not really a Regexp lib but I can use it to write my expressions on it and then execute the preprocessor to get the generated C code.
[Real Regex Lib]
http://www.osix.net/modules/article/?id=349...
Can a single regex be used to valdate urls and match all the parts, I have been working on one and what I have come up with so far is:
(?:(?P<scheme>[a-z]*?)://)?(?:(?P<username>.*?):?(?P<password>.*?)?@)?(?P<hostname>.*?)/(?:(?:(?P<path>.*?)\?)?(?P<file>.*?\.[a-z]{1,6})?(?:(?:(?P<query>.*?)#?)?(?P<fragment>.*?)?)?)?
however this does...
I need to write some javascript to strip the hostname:port part from a url, meaning I want to extract the path part only.
i.e. I want to write a function getPath(url) such that getPath("http://host:8081/path/to/something") returns "/path/to/something"
Can this be done using regular expressions?
...
In AS3 you have a function on a string with this signature:
function replace(pattern:*, repl:Object):String
The repl:Object can also specify a function. If you specify a function, the string returned by the function is inserted in place of the matching content.
Also, is it possible to get the the original string in which I want to re...
I need some help getting a regex working to parse all referrers from an apache access log file which come from real links offsite and which are valid referrals from real people rather than bots or spiders. I'm working in Perl.
This bit of code almost works already [the access log is opened with the filehandle $fh]:
my $totalreferals = ...
In regards to this: http://stackoverflow.uservoice.com/pages/general/suggestions/103227-parser-does-not-match-all-valid-urls is this regex adequate or will it need to be refined, if it needs to be refined how so?
\b(?P<link>(?:.*?://)[\w\-\_\.\@\:\/\?\#\=]*)\b
...
I am try use
(?<key>.{5}keyword.{5}?)
to test "other string keyword other text"
it will get "ring keyword othe"
and I want "akeyword other text" or "other string keyworda" or "akeywordc" are match, too.
How to modify regex?
I have a long string and I want get find keyword and get it with perfix and suffix string
demands 5 just...
I have following text in a file
23456789
When i tried to replace the above text using command
1,$s/\(\d\)\(\d\d\d\)\(\d\d\)*\>/\3\g
I am getting 89. Should't it be 6789? Can anyone tell me why it is 89.
...