Java has a regex function called "LookingAt()" which will allow partial matches against patterns, my question is:
Does .net have an equivalent of "LookingAt()"?
I may or may not use it for KeyPress validation but I just would like to know for future reference.
Thanks in advance
Jon
...
The .Net C# offers two (well four) constructors:
Regex(String)
Regex(String,RegexOptions)
The first constructs a regular expression with default options, while the second gives you somewhat more control. Take a peak under the hood with Reflector shows that the first constructor calls the second with a RegexOptions.None as second para...
I have a list of objects output from ldapsearch as follows:
dn: cn=HPOTTER,ou=STUDENTS,ou=HOGWARTS,o=SCHOOL
dn: cn=HGRANGER,ou=STUDENTS,ou=HOGWARTS,o=SCHOOL
dn: cn=RWEASLEY,ou=STUDENTS,ou=HOGWARTS,o=SCHOOL
dn: cn=DMALFOY,ou=STUDENTS,ou=HOGWARTS,o=SCHOOL
dn: cn=SSNAPE,ou=FACULTY,ou=HOGWARTS,o=SCHOOL
dn: cn=ADUMBLED,ou=FACULTY,ou=HOGWARTS...
hi,
i have a list of regex patterns (stored in a list type) that I would like to apply to a string.
Does anyone know a good way to:
Apply every regex pattern in the list to the string
and
Call a different function that is associated with that pattern in the list if it matches.
I would like to do this in python if possible
thanks ...
I need a Perl regular expression to match a string. I'm assuming only double-quoted strings, that a \" is a literal quote character and NOT the end of the string, and that a \ is a literal backslash character and should not escape a quote character. If it's not clear, some examples:
"\"" # string is 1 character long, contains dobule ...
So I have this .htaccess file in the /blog/ folder on my webserver and to work with the blog CMS we are using for this particular client (Expression Engine) I wrote this .htaccess to make the URLs SEO friendly. It all works great unless I go to www.example.com/blog/ then it goes through to the bottom rule which I don't want it to.
I ...
Ok so I have this regex that I created and it works fine in RegexBuddy but not when I load it into php. Below is an example of it.
Using RegexBuddy I can get it to works with this:
\[code\](.*)\[/code\]
And checking the dot matches newline, I added the case insensitive, but it works that way as well.
Here is the php:
$q = "[code]<d...
Why do PHP regexes have the surrounding delimiters? It seems like it would be more clear if any pattern modifiers were passed in as a parameter to whatever function was being used.
...
I've managed to find the Regex to get almost the result I want here i.e.
Regex r1 = new Regex(@"\[(.*?)\]");
string row = HEADERNAMES[COL1,COL2,COL3,COL4];
Match match = r1.Match(row);
string result = match.ToString();
Outputs: "[COL1,COL2,COL3,COL4]";
I know I can then use:
result.Replace("[", "");
result.Replace("]", "");
to get...
I'm trying to figure out how to check if a string matches a regular expression, but I want to know if the entire string matches just once. Here's my code but it seems absurdly long
def single_match(test_me, regex)
ret_val = false
test = regex.match(test_me)
if (test.length==1 && test[0].length == test_me.length)
ret_val = tr...
Using the .NET framework, I'm trying to replace double slash characters in a string with a single slash, but it seems to be removing an extra character and I don't know why.
I have a string:
http://localhost:4170/RCRSelfRegistration//Default.aspx
My regex is:
[^(://|:\\\\)](\\\\|//|\\/|/\\)
And the return value is:
http://localho...
What would be the valid .htaccess rules for doing something like this
/mypage/ --> /index.php?page=mypage
/mypage/param1/value1/ -->index.php?page=mypage¶ms=param1/value1
With an potentially unlimited number of parameters?
Thanks.
...
I'm writing a java class which would be invoked by a servlet filter and which checks for injection attack attempts and XSS for a java web application based on Struts. The InjectionAttackChecker class uses regex & java.util.regex.Pattern class to validate the input against the patterns specified in regex.
With that said, I have following...
I need some help with regex.
I have a pattern AB.* , this pattern should match for strings
like AB.CD AB.CDX (AB.whatever).and
so on..But it should NOT match
strings like AB,AB.CD.CD ,AB.CD.
AB.CD.CD that is ,if it encounters a
second dot in the string. whats the
regex for this?
I have a pattern AB.** , this pattern should match strin...
Hi,
I'm looking for a Regular Expression library I can use in our application, which is written in PowerBuilder (PB has some RegEx functionality, but it's too limited for my needs). Required characteristics are:
interface: COM or exported functions (can't use exported classes)
Unicode
Free
Production ready
Any suggestions where can ...
I have a msg like
Max {0} chars allowed in {1}
I have a function to create a message using the arguments passed as
for(var i = 0; i < agrs.length; i++){
reg = new RegExp('\{'+i+'\}', 'gi');
key = key.replace(reg,agrs[i])
}
The problem is that its not able to take the param "i" to create the reg exp.
Whats the way to achiev...
I have the following situation:
There is a tool that gets an XSLT from a web interface and embeds the XSLT in an XML file (Someone should have been fired). "Unfortunately" I work in a French speaking country and therefore the XSLT has a number of words with accents. When the XSLT is embedded in the XML, the tool converts all the accents...
I'm new to TDD, and I find RegExp quite a particular case. Is there any special way to unit test them, or may I just threat them as regular functions?
...
How can I fix this RegEx to optionally capture a file extension?
I am trying to match a string with an optional component, but something appears to be wrong. (The strings being matched are from a printer log.)
My RegEx (.NET Flavor) is as follows:
.*(header_\d{10,11}_).*(_.*_\d{8}).*(\.\w{3,4}).*
--------------------------------------...
I guess my question is best explained with an (simplified) example.
Given the case there's one regex like
^\d+_[a-z]+$
and another regex like
^\d*$
it's clear that something regex 1 matches to, will never match regex 2.
So regex 2 is orthogonal to regex 1.
As many people asked what I meant by orthogonal I'll try to clarify it:
L...