regex

In Actionscript, how to match / in infinitive structures like to cross out/off?

Hi, I'm using the following regular expression to find the exact occurrences in infinitives. Flag is global. (?!to )(?<!\w) (' + word_to_search + ') (?!\w) To give example of what I'm trying to achieve looking for out should not bring : to outlaw looking for out could bring : to be out of line looking for to should not bring : to e...

match pattern regex coldfusion

i need to match a pattern using reMatchNoCase("(listid)","listid car van listid dog cat listid house hotel")> so listid is the pattern and match that and everything to the next pattern witch is listid again. so if i dump the rematch ill get a structure each starting with listid and the content within this is what it should look like ...

Greedy Regex Matching

I'm trying to match a string that looks something like this: <$Fexample text in here>> with this expression: <\$F(.+?)>{2} However, there are some cases where my backreferenced content includes a ">", thus something like this: <$Fexample text in here <em>>> only matches example text in here <em in the backreference. What do I ne...

Python regex with unicode characters bug?

Long story short: >>> re.compile(r"\w*").match(u"Français") <_sre.SRE_Match object at 0x1004246b0> >>> re.compile(r"^\w*$").match(u"Français") >>> re.compile(r"^\w*$").match(u"Franais") <_sre.SRE_Match object at 0x100424780> >>> Why doesn't it match the string with unicode characters with ^ and $ in the regex? As far as I understand ...

Is this regex correct to denote only strings with min length of 3 and max length of 6 ?

Rules for the regex in english: min length = 3 max length = 6 only letters from ASCII table, non-numeric My initial attempt: [A-Za-z]{3-6} A second attempt \w{3-6} This regex will be used to validate input strings from a HTML form (i.e. validating an input field). ...

Regex email address validation fails if Underscore character present

Hi! I'm very new to Regular Expressions, but I thought it'd be the best way to validate email addresses entered on my form. My Regex works, except if the email address entered has an underscore character (_) in it. Because of my lack of experience with regular expressions, I'm not sure where in my pattern I'm supposed to add the offen...

regular expression to detect numbers written as words

Hi all, I need PHP code to detect whether a string contains 4 or more consecutive written numbers (0 to 9), like : "one four six nine five" or "zero eight nine nine seven three six six" ...

Regular expression for nested C structs

Hi all, I am trying to write a regex to solve the below C struct for one of our requirement. I am parsing the C structure file. In that I will have child and parent struct. The child will inherit parent struct members. I want the output, which consists of struct members and there length for further processing INPUT: #define Len1 10;...

Regex Eliminate Vertical Bar/ Pipe Character

Using the following regex with the ExtJS library, the intention is to only allow spaces, dollar signs, underscores, alpha and numeric characters. However, for some reason, the vertical bar/ pipe character is allowed as well. I hope someone can tell me what I am missing here. Am I inadvertently escaping one of the vertical bars? maskRe:...

how to remove double white space using regexp (javascript)

how to remove double white space using regexp (javascript) ? var text = "My name is Anas Fares"; result var result = "My name is Anas Fares"; Maybe it needs regexp :) How can i learn regexp because it is very hard. Are there any simple book ? ...

regular expression which returns false always

Possible Duplicate: What regular expression can never match? how do i write a regular expression which returns false always in php. i wanted this bcos . i wanted to display a error msg with out a form rule...so i did like this.. if($values['result_msg'] == 'ERROR') { $form->registerRul...

Regular expression for constants in C

I want to write regular expression for constants in C language. So I tried this: Let digit -> 0-9, digit_oct -> 0-7, digit_hex -> 0-9 | a-f | A-F Then: RE = digit+ U 0digit_oct+ U 0xdigit_hex+ I want to know whether I have written correct R.E. Is there any other way of writing this? ...

Regex to turn /01/02/007/... into 01/02 and /01 into 01/NA - is it possible?

I have filesystem-like (but numerical) path of arbitrary length which I need to canonicalize to a fixed depth (2 or 3). Basically, I want this result: /01/02/007/008 -> 01/02/007 /01/02/007 -> 01/02/007 /01/02 -> 01/02/NA /01 -> 01/NA/NA I want to do with using Oracle's regexp_replace() function, which a...

Python Regular expression must strip whitespace except between quotes

As the title says, I need a way to remove all whitespace from a string, except when that whitespace is between quotes. result = re.sub('".*?"', "", content) This will match anything between quotes, but now it needs to ignore that match and add matches for whitespace.. ...

google analytics regular expression advanced segment

I have a page that displays details of a program, I want to set an advanced segment in google analytics to only return pages that contain /program/view/path_to_program so only program detail pages display, the third segment pages are the only pages I want to display in the google analytics results. I know this will take some sort of ...

URL Regex is not working

Using Perl, I am trying to parse a bunch of XML files and trying to find any form of URL in the XML and print it. My regex does not seem to work and it is not returning any match. What am i missing? sub findURL{ local($inputLine, $outText); $inputLine = $_[1]; while (length($inputLine) > 0) { if ($inputLine =~ /^(((http|https|ftp):\/...

How to replace all html tags from <anything> to \n<anything>\n [using regexp (JavaScript)]

How to replace all HTML tags from <anything> to \n<anything> and </anything> to <anything>\n var text = "<anything>welcome</anything><anything>Hello</anything>"; result var text = "\n<anything>welcome</anything>\n\n<anything>Hello</anything>\n"; This code will help you (match all tags) </?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]...

Perl regex: how to know number of matches

Hi, I'm looping through a series of regexes and matching it against lines in a file, like this: for my $regex (@{$regexs_ref}) { LINE: for (@rawfile) { /@$regex/ && do { # do something here next LINE; }; } } Is there a way for me to know how many matches I've got (so I can process it acc...

Remove all text between 2 sentences in regex

I going crazry with regex. I need to extract a words between FROM and WHERE in this syntax: SELECT IDClient, Client FROM Client WHERE IDClient = 1 GROUP BY IDClient, Client ORDER BY IDClient result = Client How can I resolve this using regular expressions? ...

String manipulation vs Regexps

We are often told that Regexps are slow and should be avoided whenever possible. However, taking into account the overhead of doing some string manipulation oneself (not talking about algorithm mistakes - this is a different matter), especially in PHP or Perl (maybe Java) what is the limit, in which case can we consider string manipulat...