regex

what do I use to match MS Word chars in regEx

I need to find and delete all the non standard ascii chars that are in a string (usually delivered there by MS Word). I'm not entirely sure what these characters are... like the fancy apostrophe and the dual directional quotation marks and all that. Is that unicode? I know how to do it ham-handed [a-z etc. etc.] but I was hoping there w...

Python -- Regex -- How to find a string between two sets of strings

Consider the following: <div id=hotlinklist> <a href="foo1.com">Foo1</a> <div id=hotlink> <a href="/">Home</a> </div> <div id=hotlink> <a href="/extract">Extract</a> </div> <div id=hotlink> <a href="/sitemap">Sitemap</a> </div> </div> How would you go about taking out the sitemap line with regex in python? <...

Regex prefix only matches when in a look-behind assertion

I'm trying to write a regex to parse a (seemingly very simple) piece of text like this. some stuff First name: John Last name: Smith more stuff I want to capture the first and last name, so I tried a regex like this: (?<=First name:\s*)(?<FirstName>\w+)(?<=\s*Last name:\s*)(?<LastName>\w+) This fails to find a match. Each part (fir...

Regular Expression Opposite

Is it possible to write a regex that returns the converse of a desired result? Regexes are usually inclusive - finding matches. I want to be able to transform a regex into its opposite - asserting that there are no matches. Is this possible? If so, how? http://zijab.blogspot.com/2008/09/finding-opposite-of-regular-expression.html st...

How to prevent Regular Expression of hang (or set time out for it) in .Net

Hi to all, I just using regular expression to remove comment tag in html file (Pattern is: "<!--(.|\s)*?--!?>") but some site not using standard html tag, sample: <script language="javascript"> <!-- js code ... </script> in this case, my regular expression hang, and also try-catch does not catch error. Are you have an...

[Perl]: Read directory and files, and regex

Hi all, from this string, (champs1 (champs6 donnee_o donnee_f) [(champs2 [] (champs3 _YOJNJeyyyyyyB (champs4 donnee_x)) (debut 144825 25345) (fin 244102 40647)), (champs2 [] (champs3 _FuGNJeyyyyyyB (champs4 donnee_z)) (debut 796443 190570) (fin 145247 42663))] [] [])., i would like to extract the first number after the word "debut", and...

jquery and RegExp‬

I build a function thar replace a keyword in the HTML to a link. The problem is that when the keyword is in a link then it will replaced it. $(document).ready( function () { $("#content").highlight( "example", "<a href=\"http://www.example.com\"&gt;$1&lt;/a&gt;" );}); jQuery.fn.highlight = function (text, o) { return this.each( functi...

Remove Whitespace using Erlang Regex

Hello, T = {xmlelement,"presence", [{"xml:lang","en"}], [{xmlcdata,<<"\n">>}, {xmlelement,"priority",[], [{xmlcdata,<<"5">>}]}, {xmlcdata,<<"\n...

RegEx - Looking for emails inside of a log file

Hey everyone, I am looking for a regular expression that will test for matches against a string such as: mxtreme1.log:May 12 07:00:00 10.1.1.175 postfix/cleanup[48145]: C2C9FFA730: fullname=, [email protected], [email protected], [email protected], prior=, as_score=0, as_strategy=M, code=W, actions=FFFFFFF...

Get "Title" attribute from html link using Regex

I have the following Regex to match all link tags on a page generated from our custom cms <a\s+((?:(?:\w+\s*=\s*)(?:\w+|"[^"]*"|'[^']*'))*?\s*href\s*=\s*(?<url>\w+|"[^"]*"|'[^']*')(?:(?:\s+\w+\s*=\s*)(?:\w+|"[^"]*"|'[^']*'))*?)>.+?</a> We are using c# to loop through all matches of this and add an onclick event to each link (for track...

Which regular expression is able to select excel column names in a formula in C#?

I'm nedding to implement excel formula autofill in C#. Let's suppose this formula is located at B100: =SUM($B$99:B99) I want to make this formula different at C100: =SUM($B$99:C99) This formula is only an example. Some real examples are: =(SUM($B${0}:B{0})/SUM({1}!$B${0}:{1}!B{0}) -1) =SUM(B{0}:B{1}) =B{0} + B{1} =C{0}+ B{1} ...

Regex to get a guid from a email reply

Trying to figure out the Regex pattern to match if an email contains a Guid, e.g. [email protected] The Guid could potentially be anywhere before the @, e.g. [email protected] ...

How do I replace part of string using regexp?

HI, I have a string that looks like /dir/dir1/filename.txt I want to replace the "filename.txt" with some other name leaving the "/dir/dir1" intact so after the replace the string would look like /dir/dir1/newfilename.txt how would I do that using RegExp in Perl considering that I don't know the value of "filename" Many Thanks...

RegEx: Find quotes within a tag

Hi, I have a string like this: This <span class="highlight">is</span> a very "nice" day! How should my RegEx-pattern in VB look like, to find the quotes within the tag? I want to replace it with something... This <span class=^highlight^>is</span> a very "nice" day! Something like <(")[^>]+> doesn't work :( Thanks ...

Regular expression to find and replace a string in a xml

I'm looking for one regular expression that could match a string for three specific cases in a xml file: : Double-quotes surrounding a string. : A string surrounded by the characters greater than and Less Than. : A string surrounded by the characters ; and &. Example: "MyString" - Valid match >MyString< - Valid match ;MyString - I...

Copy a directory tree to a single directory at a command line

Anyone know of a command line utility (or one that can run as a command line) that will collect all the .jpg files in a directory tree to a single folder, only copying files that change? I started with Renamer, which is great for renaming files in their current directories, but fell short when I tried to mangle the path. This is probab...

Java + regex how to check such a string "LOAD_filesourceB-01012008_000058.dat" for type and number(last 6 digits)

how to implement such a requirement via regexp? I have a list of filenames as String's. LOAD_filesourceA-01012008-00001.dat LOAD_filesourceB-01012008-00001.dat LOAD_filesourceB-01012008-00003.dat LOAD_filesourceA-01012008-00004.dat LOAD_filesourceA-01012008-000055.dat LOAD_filesourceB-01012008_000055.dat ... LOAD_filesourceB-01012008_00...

Regular expression grouping issue

I have some text data in this format: MI 00 3 MD 1 0.0000 MD 2 0.0000 MD 3 0.0000 This block can be repeated and the number of MDs is variable (but always >= 1) and the numeric values following need to be captured for each one. I have a regex that matches every MD per MI but it will only capture the last MD. Is it possible to captu...

how to fix this regular expression non-greedy problem?

preg_match('/(.*?)see below[^,\.<]*/s',$xml,$match); echo $match[0]; the ouput is,which I think the non-greedy matching is not working: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt; <soap:Header> <UserCredentials xmlns="http://jobg8.com/postadve...

How do capture groups work? (wrt python regular expressions)

While using regex to help solve a problem in the Python Challenge, I came across some behaviour that confused me. from here: (...) Matches whatever regular expression is inside the parentheses. and '+' Causes the resulting RE to match 1 or more repetitions of the preceding RE. So this makes sense: >>>import re >>>re.findall(r"(\d+...