regex

String pattern matching problem in Java

In my program when I'm using line.replaceAll("(", "_"); I got a RuntimeException: at java.util.regex.Pattern.error(Unknown Source) at java.util.regex.Pattern.accept(Unknown Source) at java.util.regex.Pattern.group0(Unknown Source) at java.util.regex.Pattern.sequence(Unknown Source) at java.util.regex.Pattern.expr(Unknown Source)...

How to use this with JQuery

hi, how do i use this code with jquery, i know it's easy but it doesn't work for me. document.getElementsByTagName('html')[0].innerHTML.replace(/<!--|-->/g,'') ...

Regex, get string value between two characters

Howdy, I'd like to return string between two characters, @ and dot (.). I tried to use regex but cannot find it working. (@(.*?).) Anybody? ...

Regex string for IRC

I am trying to write a regex string to match a string revived from an IRC channel. The message will be in the format "!COMMAND parameters"; the only command that is built by the system so far is repeat. The regex I am using looks like this: /![repeat] (.*?)/ When other commands are added it will look like: /![cmd1|cmd2|cmd3] (.*?)/...

Email Validation: converting a regular expression written in PHP (preg) to .NET (Regex)

Based on this answer... http://stackoverflow.com/questions/201323/what-is-the-best-regular-expression-for-validating-email-addresses/201378#201378 Which led me to this site... http://fightingforalostcause.net/misc/2006/compare-email-regex.php I'd like to use this regex for email validation for my ASP.NET MVC app: /^[-_a-z0-9\'+*$^&%=~...

JS+Regexp: Match anything except if it's between [[ ]]

I've got a <textarea> that will be basically a list of names, so I set a function to replace the spaces between the names for a new line. Now I need to specify that two or more spaces between names are in fact part of the same element. IE: John Lucas [[Laurie Vega]] [[Daniel Deer]] Robert Should turn to John Lucas [[Laurie Vega]] [[...

How to check if a Regex expression matches an entire string in c#?

Hi, I am new to regex expressions so sorry if this is a really noob question. I have a regex expression... What I want to do is check if a string matches the regex expression in its entirety without the regex expression matching any subsets of the string. For example... If my regex expression is looking for a match of \s*A*\s*, it sho...

with and without trailing slash

What would I make this rule so that you can access it with and without trailing slash? RewriteRule ^members/([^/]+)$ members.php?id=$1 [L] ...

could you explain to me this regular expression?

Sure it's a regular expression's newbie question, I saw it in a program but I can't understand the part of the two backslashes, Does "\\" have a special meaning like \r or \t? [a-zA-Z]+\\.? Thank you ...

how to replace all Uppercase letters with spacing ?

$string = "MaryGoesToSchool"; $expectedoutput = "Mary Goes To School"; ...

PHP RegEx extension - How to strip only url=* ?

Hi! I've written a regular expression to strip out BBCode tags - it just strips the allowed tags out (for later counting the string length without the tags). I'm not an expert when it comes to regular expressions - so after an hour I found this pretty much working: $pattern = "/\[\/?(i|b|u|url(.*?)|list|li)[\]\[]*\]/i"; $stripped = pre...

replacing linebreaks in javascript doesn't work :(

Hey there, I'm trying to replace a <blockquote>...</blockquote> with >> ... This is my Code: var testhtml = 'sdkjhfbs <blockquote>skldfjsfkjghbs\n sdjkfhb ksdbhv isl\n kdjbhdfgkj bs</blockquote>kdjfgnkdfj'; alert(blockquoteConvert(testhtml)); function blockquoteConvert(html) { return '>>' + html. replace(/<blockquot...

regex match www or nothing

Hi I have the following urls: www.localhost.com localhost.com test.localhost.com How would I match match www or nothing in a regex? Thanks, Andy ...

How do I make these Perl regexs Python compatible?

I have these two lines in an old Perl script. When I write the Python equivalent I get all sorts of errors like valueerror: invalid \x escape, and stuff about encoding. $line =~ s/[^\x{8}-\x{7B}]/ /ig; $line =~ s/(Û|²|°|±|É|¹|Í)/ /g; What do I need to do to get them working in Python? ...

python-re: How do I match an alpha character.

How can I match an alpha character with a regular expression. I want a character that is in \w but is not in \d. I want it unicode compatible that's why I cannot use [a-zA-Z]. ...

Remove repeated chars completely (regex/C#)

Looking for a one line C# code that would remove repeated chars from a string. Have done it with a simple loop with look-ahead but like to see a regex soln. Ex. input = "6200032111623451123345666" output = "623262345245" Thanks. Lyle ...

Java Regular Expressions

Hallo, I have the following syntax: @AAAA{tralala10aa, author = {Some Author}, title = {Some Title}, booktitle = {Some Booktitle}, year = {2010}, month = {March}, booktitle_short = {CC 2010}, conference_url = {http://www.mmmm.com}, projects = {projects} } .... I've made the following regular expression: @[A-Z]*[{][...

how do i regex search for weird non-ascii characters in python?

I'm using the following regex basically to search for and delete these characters. invalid_unicode = re.compile(ur'(Û|²|°|±|É|¹|Í)') My source code in ascii encoded, and whenever I try to run the script it spits out: SyntaxError: Non-ASCII character '\xdb' in file ./release.py on line 273, but no encoding declared; see http://www.pyt...

Regular expression for a string literal in flex/lex

I'm experimenting to learn flex and would like to match string literals. My code currently looks like: "\""([^\n\"\\]*(\\[.\n])*)*"\"" {/*matches string-literal*/;} I've been struggling with variations for an hour or so and can't get it working the way it should. I'm essentially hoping to match a string literal that can't conta...

Need help writing a regex

Hi folks! I'm trying to find the latter half of patterns of the following template: foo/BAR 'BAR' is the one I'm trying to retrieve. I tried with something like: \b(foo)/([a-zA-Z]+) This works fine, but this also matches http://foo/BAR - which I don't want. I also tried \\s(foo)/([a-zA-Z]+) but this doesnt match when the lin...