Simple question:
What is the pattern for the word character \w in c#, .net?
My first thought was that it matches [A-Za-z0-9_] and the documentation tells me:
Character class Description Pattern Matches
\w Matches any \w "I", "D", "A", "1", "3"
word character. ...
I have nested subdirectories containing html files. For each of these html files I want to delete from the top of the file until the pattern <div id="left-
This is my attempt from osx's terminal:
find . -name "*.html" -exec sed "s/.*?<div id=\"left-col/<div id=\"left-col/g" '{}' \;
I get a lot of html output in the termainal, but no f...
I want a regular expression which ALLOWS only this:
letter a-z
case insensitive
allows underscores
allows any nrs
How should this be written?
Thanks
...
In python (it's a Django filter), I'm doing this:
lReturn = re.sub(r'\[usecase:([ \w]+)]', r'EXTEND WITH <a href="/usecase/%s/\1/">\1</a>' % pCurrentProjectName, lReturn)
I'd like to use a function instead of a string (so I can check that the usercase is a valid name), so it would change to this:
def _match_function(matchobj):
lM...
Hey guys
I'm trying to use a RegularexpressionValidator to match an IP address (with possible wildcards) for an IP filtering system.
I'm using the following Regex:
"([0-9]{1,3}\\.|\\*\\.){3}([0-9]{1,3}|\\*){1}"
Which works fine when running it in LINQPad with Regex.Matches, but doesn't seem to work when I'm using the validator.
Doe...
Now that I have nginx setup I need to be able to hide my .git directories. What kind of rewrite would I need to stop prying eyes? And where in the server {} or http {} block would it go?
...
I was reading about regular expressions (I'm a regex newbie, but want to learn them) and came across this regex:
/^(?!http:\/\/www.google.com).*/
and I didn't know what or when it would match...so my question is just that, what/when would this regex match?
Thanks for helping out a regex padawan!
...
I am wondering what this technique is called and what it does. It seems to be validating some regular expression on the variable url. I am customizing another persons code:
var url = document.getElementById("editorURL").value;
if(/(file|http).*/.test(url)) {
}
Maybe someone has a link to an article that explains this a bit more in...
Trying to find a way to trim spaces from the start and end of the string. I was using this, but it dont seem to be working:
title = title.replace(/(^[\s]+|[\s]+$)/g, '');
Any ideas?
...
I have several very large XML files and I'm trying to find the lines that contain non-ASCII characters. I've tried the following:
grep -e "[\x{00FF}-\x{FFFF}]" file.xml
But this returns every line in the file, regardless of whether the line contains a character in the range specified.
Do I have the syntax wrong or am I doing somethin...
I have the following C# code which should match a quantity / $ price string like "4/$3.99". It works all day long until we use it against a string returned from Firefox Browser. 77.77 becomes 77 (dropping the .77 cents).
var matches = Regex.Match(_priceText,
@"^\s?((?<qty>\d+)\s?/)?\s?[$]?\s?(?<price>[0-9]?\.?[0-9]?[0-9]?)");
if...
i have been type some string inside textfield that is "KD-G435MUN2D"...
i already use this code for search "UD" character from that string:
<script>
var str="KD-R435MUN2D";
var patt1=/UD/gi;
document.write(str.match(patt1));
</script>
but this code doesn't work..where is my fault?
...
I'm trying to pull data from Jim Breen's WWWJDIC. The raw data returned has a lot of information delimited in several different formats.
The data pulled in the example below is from here:
http://www.csse.monash.edu.au/~jwb/cgi-bin/wwwjdic.cgi?1ZUJ%E5%85%88%E7%94%9F
先生 [せんせい] /(n) (1) teacher/master/doctor/(suf) (2) with names of teach...
Hi,
I know this has been discussed a million times. I tried searching through the forums and have seen some close regex expressions and tried to modify them but to no avail.
Say there is a line in a csv file like this:
"123", 456, "701 "B" Street", 910
Is there an easy regex to detect "B" (since its a non-escaped set of quotes within...
how to modify this code if i want search JD from var str="KD-S35JWD"..i try this but doesn't work:
<script type="text/javascript">
var str = "KD-R435jwd";
var hasUD;
var hasJD;
var hasED;
var hasEED;
var patt1 = str.match(/U/gi);
var patt2 = str.match(/J/gi);
var patt3 = str.match(/E/gi);
var patt4 = str.match(/EE/gi);
var patt5 = str....
i have this code for get data from textfield:
<script type="text/javascript">
var mod=document.getElementById("mod").value;
ajax(mod);
function callback() {
if(ajaxObj(mod) {
document.getElementById("divResult").innerHTML=ajaxObj.responseText;
});
};
</script>
this code for show r...
I have this URL:
http://example.com/createSend/step4_1.aspx?cID=876XYZ964D293CF&snap=true&jlkj=kjhkjh&
And this regex pattern:
cID=[^&]*
Which produces this result:
cID=87B6XYZ964D293CF
How do I REMOVE the "cID="?
Thanks
...
Why doesn't this assign prepClass to the string selectorClass with underscores instead of non alpha chars? What do I need to change it to?
var regex = new RegExp("/W/", "g");
var prepClass = selectorClass.replace(regex, "_");
...
Hello friends,
How can i prevent user to enter any url or link in contact form text area, i have tried it with this but its not working -
if (!isset($_POST['submit']) && preg_match_all('/<a.*>.*<\/a>/', $_POST['query']))
{
echo "<h1 style='color:red;'>HTML Tag Not allowed </h1>";
}
else {
//sendmail
...
Hi,
I want to extract the status from the string untill I found a timespan. My input is something like "Something in start but not with this keyword of sure. STATUS: My Status Is Here Which can be anything but timespan 23:59:01 and so on. I want to extract the string after STATUS: untill 23:59:01 is found. How can i achieve this through ...