regex

enterprise library VAB Implementation issues

Hi All.. I have an issue with the implementation of VAB. We are using ASP.NET MVC 1.0 I have a property "First Name" and we want to have 2 validations. Not Null Validator RegEx Validator (to stop some characters) Now if I leave it blank then it gives me the error message from both the validator. If the First name is blank I only w...

regular expression domain address

i am using this regular expression and it works fine for the two dots which accepts abc.com.ae or abc.com , but i want to make it work for three dots like abc.abc.com.ae or abc.com.ae or abc.com (the first portion and the last portion is optional . how can i do that?` ^[A-Za-z0-9]{1,30}\.[a-z]{3}((\.)[a-z]{2})?$ ...

use of ".*?" in .NET regex

Possible Duplicate: Difference between .? and . for regex I was reading this question, and noticed that many of the regular expressions in the answers used .*? to match intermediate text, rather than just .*. To my mind, using .* will match any character zero or more times. Adding ? would be superfluous, as it would just mod...

Regular Expression to match more than one occurrence of a character

Hello, I need help coming up with a regular expression to match if a string has more than one occurrence of character. I already validated the length of the two strings and they will always be equal. Heres what i mean, for example. The string "aab" and "abb". These two should match the regular expression because they have repeating chara...

Getting text from inside an HTML tag within a local file with grep

Possible Duplicate: RegEx match open tags except XHTML self-contained tags Excerpt From Input File <TD class="clsTDLabelWeb" width="28%">Municipality:&nbsp;</TD> <TD style="WIDTH: 394px" class="clsTDLabelSm" colSpan="5"> <span id="DInfo1_Municipality">JUPITER</span></TD> My Regular Expression (?<=<span id="DInfo1_Municipal...

tr1::regex regex_search problem

Hey all, I'm using tr1::regex to try to extract some matches from a string. An example string could be asdf werq "one two three" asdf And I would want to get out of that: asdf werq one two three asdf With stuff in quotes grouped together, so I'm trying to use the regex \"(.+?)\"|([^\\s]+). The code I'm using is: cmatch res...

php regular expression : How to fetch all the email address in a paragraph

Hello guys, I want to fetch all the email address in a paragraph. could you please help me Thanks a lot ...

how can i extract an value using regex java?

hello, i need to extract the numbers alone from this text i use sub string to extract the details some times the number decreases so i am getting an error value... example(16656); ...

Nested quantifiers in boost::regex

Is \d++ a valid regular expression in programming languages that don't support possessive quantifier?Is it equivalent to (\d+)+? When testing it in Python,an error sre_constants.error: multiple repeat will be raised.In C#,it will throw a runtime exception:System.ArgumentException: parsing "\d++" - Nested quantifier +.As well as boost:...

Recursive regex

Hi there ! I have the following string in php: $string = 'FEDCBA9876543210'; The string can be have 2 or more (I mean more) hexadecimal characters I wanted to group string by 2 like : $output_string = 'FE:DC:BA:98:76:54:32:10'; I wanted to use regex for that, I think I saw a way to do like "recursive regex" but I can't remember i...

Find matching bracket with Regex

The input is a string representing a list of elements. A list is defined as an open curly { followed by 0 or more elements separated by whitespace followed by a closed curly }. An element is either a literal or a list of elements. A literal is a succession of non-whitespace characters. If an element contains a curly bracket, it must ...

PHP mb_ereg_replace not replacing while preg_replace works as intended.

I am trying to replace in a string all non word characters with empty string expect for spaces and the put together all multiple spaces as one single space. Following code does this. $cleanedString = preg_replace('/[^\w]/', ' ', $name); $cleanedString = preg_replace('/\s+/', ' ', $cleanedString); But when I am trying to use mb_ereg...

word boundary on non latin characters in php

This example works fine: echo preg_replace("/\bI\b/u", 'we', "I can"); // we can This one were russian letters are used does not work even though I use "u" modifier: echo preg_replace("/\bЯ\b/u", 'мы', 'Я могу'); // still "Я могу" So the question is what should I do to fix this? Thanks. ...

Why does this function not autolink?

function twitterify($ret) { $ret = preg_replace("#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret); $ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret); $ret = preg_replace("/@(\w+)/", "<a href=\"http://www.twit...

How to convert the replace() javascript regex function to actionscript?

Both JS and AS3 implement RegEx as defined in the ECMAScript edition 3 language specification (ECMA-262). Although I may not have any trouble converting the regular expressions themselves, in javascript I see the string.replace() function used. AS3 only has exec() and test(), are they equivalent to replace()? ...

How can I turn a list of words in a text file into a regex to filter out?

I'm trying to filter out some text for certain keywords that are found in a text file. I was thinking about just parsing the file line by line, take each word and then merge them together with a pipe "|" then using that string inside re.sub. Any better more efficient ideas are welcome. ...

How to make a regular expression looking for a list of extensions separated by a space

Hello, I want to be able to take a string of text from the user that should be formated like this: .ext1 .ext2 .ext3 ... Basically, I am looking for a dot, a string of alphanumeric characters of any length a space, and rinse and repeat. I am a little confused on how to say " i need a period, string of characters and a space". But also...

how to replace url in css using regexp (javascript)

var text = '#anything {behavior:url("csshover.htc");}'; //iam using " with url text += "#anything {background:transparent url('img.png') no-repeat;}"; //iam using ' with url text += "#anything {background-image:url('ok.jpg');}"; result #anything { behavior:url("#"); } #anything { background:transparent url('#') no-repeat; } ...

How do you understand regular expressions that are written in one line?

This is a neat well documented regular expression, easy to understand, maintain and modify. text = text.replace(/ ( // Wrap whole match in $1 ( ^[ \t]*>[ \t]? // '>' at the start of a line .+\n // rest of the first line (.+\n)* ...

Extremely Simple Regex Expression Clarification (10)*

Hey all, I feel bad about asking a question so simple, but I can't figure this out for the life of me. I need to construct a NFA based on some languages, and the only one I can't figure out is this one: L = (10)* Note that I am not asking for any help concerning the FSM, but only some clarification on what the language represents. ...