regex

python regex to get all text until a (, and get text inside brackets

I need help with 2 regex. get all text until a open bracket. e.g. this is so cool (234) => 'this is so cool' get the text inside the brackets, so the # '234' ...

Get Everything between two characters

I'm using PHP. I'm trying to get a Regex pattern to match everything between value=" and " i.e. Line 1 Line 2,...,to Line 4. value="Line 1 Line 2 Line 3 Line 4" I've tried /.*?/ but it doesn't seem to work. I'd appreciate some help. Thanks. P.S. I'd just like to add, in response to some comments, that all strings between the first ...

Regular expression for matching quantities and unit

I need to extract the quantity and unit from strings like this 1 tbsp 1tbsp 300ml 300 ml 10grams 10 g The quantities will always be numbers, then there may or may not be a space then the unit. They may be 15 - 20 different units which can come from a list that we define (perhaps an array) The solution can be in either javascript or...

Regex and ISO-8859-1 charset in java

I have some text encoded in ISO-8859-1 which I then extract some data from using Regex. The problem is that the strings I get from the matcher object is in the wrong format, scrambling chars like "ÅÄÖ". How do I stop the regex library from scrambling my chars? Edit: Here's some code: private HttpResponse sendGetRequest(String url) th...

javascript regex match function syntax help

Hi, I have an input textbox that runs a js function on the keyup event to match for a valid string (domain name pattern match, the regex was found on here). I wrote the if statements to test whether the input is a valid pattern first and then more than 3 characters long. Apparently, my ifs don't work like I wanted them to. When th...

Regexp to get domain from URL

Anyone knows the Regexp for AS3 to get the domain name from URL? E.g: "http://www.google.com/translate" will get "http://www.google.com" ...

php regex get stuff in side comment

<?php $test = "<!--my comment goes here--> Hello World "; echo preg_replace('/\<.*?\>/','',$test); ?> the code above echos hello world i want it to echo my comment goes here ...

RegExp Escape Problem?

Hi, I need some RegExp help for a Flex 3 website. I'm trying to find this: px;'</img> And replace it with: px;'></img> I've tried: var tester: String = " blah height: 0px;'<\img>blah"; var pattern1:RegExp = /px;'<\/img>/g; tester = tester.replace(pattern1, "px;'></img>"); I think that the problem ...

regular expression to match exactly two words and not one of the the two

Hi all, I am wondering , how would i match the words "SAN JOSE" in a string "I love SAN JOSE but JOSE does not like it " so in essence i do not want the the word Jose to be matched but SAN JOSE should be matched together. any ideas . thanks ...

How do I replace an arbitrary number of backreferences in sed or Perl? (for obfuscating mailto)

I'm looking for a way to obfuscate mailtos in the source code of a web site. I'd like to go from this: href="mailto:[email protected]" To this: href="" onmouseover="this.href='mai'+'lto:'+'pre'+'sid'+'ent'+'@wh'+'ite'+'hou'+'se.'+'gov'"</code> I'm probably going to go with a PHP solution instead, like this (that way I only h...

When were non-capturing parentheses added to Perl's regular expressions?

I am having a hard time figuring out the earliest version of perl where non-capturing parentheses are supported in regex patterns? Can I take this feature for granted for all versions of Perl5? ...

Regular Expression: Mathematically vs. Programmatically

Consider the following regular expressions: 7+ (7)+ Does anyone that is very familiar with regular expression theory in Mathematics agree that the two regular expressions are semantically the same? ...

Regular Expression to pull a path/filename from a string.

Given an input string, I would like to get the output from this in the specified format: filename;path. For the input string: /vob/TEST/.@@/main/ch_vobsweb/1/VOBSWeb/main/ch_vobsweb/4/VobsWebUI/main/ch_vobsweb/2/VaultWeb/main/ch_vobsweb/2/func.js I expect this output string: func.js;VOBSWeb/VosWebUI/VaultWeb/func.js The filename ...

How to extract a number from this simple string using RegExp in JavaScript?

Hi, I need to extract the number from the following simple string: base:873 where the "base:" portion is optional, i.e., it may/may not exist in the string. How am I supposed to extract the number from the above string using RegExp? P.S.: It's an unfortunate to see such a big difference between other Regular Expression implementatio...

C# RegEx on a StreamReader will not return matches.

I'm writing myself a simple screen scraping application to play around with the HTMLAgilityPack library, and after getting it to work on several different types of HtmlNodes, I figured I'd get fancy and throw in a Regex for Email addresses as well. The only problem is that the application never finds any matches, or maybe it is but not r...

Multiline regex issue in PHP

Hello, Consider the code below, why it is not working? <?php $str = " <h4> title </h4> "; $result = preg_match_all ('/<h4>([\d\D])<\/h4>/mi', $str, $matches); var_dump($matches); ...

regex for single lower case word

I am looking for a regex pattern that ensures the user puts in a single lower case word with only letters of the alphabet. Basically they are picking a subdomain. Thanks in advance ...

Get Unique Email Identifier from GMail URL

Hi! At the moment, I am coding an Google Chrome extension (in Javascript) which interfaces with GMail. The extension needs to know the unique email identifier that is present at the end of every GMail URL. Eg. https://mail.google.com/mail/#inbox/11a4ac0cg2bc3330 https://mail.google.com/mail/#label/Archived+Emails/11a4c8b472b...

Remove non-HTML special tags from text

I'm having problem with matching non-HTML tags in text mainly, because tags starts with &lt; and ends with &gt; but not < and >. So instead <ref>xx</ref> i have &lt;ref&gt;xxx&lt;/ref&gt;. What I need to do is remove all such tags including their content. The problem is that some tags may have attributes. I found nice answer here but st...

looking for the FALSE regex

Possible Duplicate: What regular expression can never match? I'm looking for a regular expression that will not match any string. Example: suppose I have the following Java code public boolean checkString(String lineInput, String regex) { final Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE); final Matc...