regex

Perl regular expression problem

I have this conditional in a perl script: if ($lnFea =~ m/^(\d+) qid\:([^\s]+).*?\#docid = ([^\s]+) inc = ([^\s]+) prob = ([^\s]+)$/) and the $lnFea represents this kind of line: 0 qid:7968 1:0.000000 2:0.000000 3:0.000000 4:0.000000 5:0.000000 6:0.000000 7:0.000000 8:0.000000 9:0.000000 10:0.000000 11:0.000000 12:0.000000 13:0.00000...

Remove non-utf8 characters from string

Hello folks, Im having a problem with removing non-utf8 characters from string, which are not displaying properly. Characters are like this 0x97 0x61 0x6C 0x6F (hex representation) What is the best way to remove them? Regular expression or something else ? ...

Why doesn't this Regular Expression match a space?

I have the following regular expression: ([0-9]+),'(.)':([0-9]+),(L|R|'.') It matches this just fine: 1,'a':1,R However, if I replace a with a space, it fails: 1,' ':1,R Why doesn't . match it? Is a space not classified as a character? I can't use \s because I don't want to match tabs and line breaks. I also tried: ([0-9]+),'(....

where can i get a regex or a library package for recognizing street address, postal code, state, phone numbers, emails and etc?

i have bunch of unformatted docs.... i need regex to capture street address, postal code, state, phone numbers, emails, such common formats... ...

Confused about a regex.

I want to match expressions that begin with "${" and end with "}" in the expression ${foo} and ${bar}. The regex .*\$\{.+\}.* matches the entire expression, of course. My understanding was that changing to the reluctant quantifier would solve the problem, but I find that .*\$\{.+?\}.* also matches the entire expression. What am I miss...

How to use RegEx?

Hi, I haven't used RegEx so please excuse me... I have a string like: string str = "https://abce/MyTest"; I want to check if the particular string starts with "https://" and ends with "/MyTest". How can I acheive that? ...

Splitting a string with curly braces as delimeters?

'{5}<blah>{0}</blah>' i want to turn that into: ['{5}', '<blah>', '{0}', '</blah>'] i currently use: ________.split(/({.*?})/); but this fails when curly brace is the first character as in the case: '{0}<blah>' which gets turned into: ['', '{0}', '<blah>'] ... a 3 element array, not a 2 what's wrong with my regex? Thanks! ...

Regex to extract sql where clause

Hi, Im making a regex expression using C# to extract the where clause of a sql expression. The whre clause can have multiple columns with different operators. Though NO grouping is allowed in the sql e.g. col1 = 5 and (col3 = 6 or col4 < 5) Only a simple format is allowed in the sql: col1 = 5 and col1 < 6 or col3 <> ? I have been ...

Matching contents inside php tags using regex

Hi, I have some trouble matching the contents inside php tags. Currently I have this code, but it's not working for me: <?php preg_match_all('/<\?php(.+)\?>/', $str, $inside_php); ?> I need to retrieve the contents so I can do other things with them, like eval(). ...

Simpler Regex for parsing Microsoft File Checksum Integrity Verifier output?

I want to parse out each modified file that is reported during FCIV's verification process. It comes out like this: "Microsoft Windows XP [Version 5.1.2600]\r\n(C) Copyright 1985-2001 Microsoft Corp.\r\n\r\nC:\MD5Checksum>C:\MD5Checksum\fciv.exe -v -xml db.xml\r\n//\r\n// File Checksum Integrity Verifier version 2.05.\r\n//\r\nStarting...

Regex for alphanumeric (unicode) with specific length

Valid ones should contain at least one number or letter (from 6 to 15 chars long) in any order. e.x. 11111a 111a11 a11111 I found similar posts within SO but they seem to be out of order... ...

Notepad++ regular expression find and replace $_REQUEST with $_GET but a more secure

What I am doing is replacing, in a large program, all $_REQUEST['var'] and mysql_escape_string($_REQUEST['var']) with either the 1st or 2nd line below the dotted line. Now, I have figured out this much of the regular expression but I would like to make it simpler. Instead of having to run the top one first then the 2nd one I would like...

Javascript Clean URL Regex

I am building a CMS news sections with a few fields but the ones notably needed for this question are the "Title" and "URL Reference" fields. When a user enters in an article title I want Javascript/jQuery to replace the text from the Title field and create a "clean" URL fragment by removing any spaces and weird characters with a dash(-...

How do I regex match with grouping with unknown number of groups

I want to do a regex match (in Python) on the output log of a program. The log contains some lines that look like this: ... VALUE 100 234 568 9233 119 ... VALUE 101 124 9223 4329 1559 ... I would like to capture the list of numbers that occurs after the first incidence of the line that starts with VALUE. i.e., I want it to return ('...

Does Delphi VCL provide a regular expression library ?

Is there a library in the VCL for regular expressions? If not can you recommend a good third party library. I am using Delphi 2009 ...

Match Regular expression from a dictionary in C#

I am trying to have some sort of Data Object (I'm thinking a dictionary) to hold a TON of regular expressions as keys, then I need to take a string of text, and match against them to get the actual value from the Dictionary. I need an efficient way to do this for a large set of data. I am in C# and I'm not sure where to begin. ...

PHP REGEX: Pls help me build the proper regex for this:

Say I had this piece of HTML for example: <div id="gallery2" class="galleryElement"> <h2>My Photos</h2> <div class = "imageElement"> <h3>@Embassy - VIP </h3> <p><b>Image URL:</b> <a href = "http://photos-p.friendster.com/photos/78/86/77426887/1_119466535.jpg" target = "_blank">http://photos-p.friendster.com/photos/78/8...

What regex will match every character except comma ',' or semi-colon ';'?

Is it possible to define a regex which will match every character except a certain defined character or set of characters? Basically, I wanted to split a string by either comma (,) or semi-colon (;). So I was thinking of doing it with a regex which would match everything until it encountered a comma or a semi-colon. ...

regular expression in .net for validating a number

I need a regular expression in .net which will only allow a maximum of two digits after "." will only allow a maximum of two digits before "." has a maximum length of 5 represents a number greater than 0 represents a number not greater than 100 has a number not greater than 11 after ".", like 5.11, 5.10, 5.03, 5.01, 5.06, etc (not 5....

Find matching strings using RegX in Javascript??

Hi, I have a requirement to filter out some of the specified strings in a given line using regx.. This can be easily achievale using string.macth(). But my requirement is little bit tricky. I have set of keywords, that needs to be identified in a given string. (My input string contains only one expected keyword). I have to form the reg...