regex

Are there any good / interesting analogs to regular expressions in 2d?

Are there any good (or at least interesting but flawed) analogs to regular expressions in two dimensions? In one dimension I can write something like /aaac?(bc)*b?aaa/ to quickly pull out a region of alternating bs and cs with a border of at least three as. Perhaps as importantly, I can come back a month later and see at a glance what ...

.Net string parsing library, or regex for parsing .Net code files

I would like to be able to parse vb.net code files, so I can examine the collection of Subs, Functions (and their contents, including comments), private variables, etc. I can be open the actual source code files. So for example, if I have: Public Function FunctionOne(arg1 As String, arg2 as String) as Integer here is some code '...

Replace content in a string based on Regex.Matches MatchCollection

I've been working on this RegEx for the past day or so and I think I have it worked out so that it returns the data I want. First a little background. I have a content editor that users will be able to edit web pages. They can format text, add links, etc.. standard content editor stuff. When they click save, the editor provides the ab...

Can someone give me a Regular Expression to identify an encoded URL?

Hello, I am currently looking to detect whether an URL is encoded or not. Here are some specific examples: http://www.linxology.com/browse.php?u=Oi8vZXNwbnN0YXIuY29tL21lZGlhLXBsYXllci8%3D&b=13 http://www.linxology.com/browse.php?u=Oi8vZXNwbnN0YXIuY29tL290aGVyX2ZpbGVzL2VzcG5zdGFyL25hdl9iZy1vZmYucG5n&b=13 Can you please give me...

Is it possible to "learn" a regular expression by user-provided examples?

Is it possible to "learn" a regular expression by user-provided examples? To clarify: I do not want to learn regular expressions. I want to create a program which "learns" a regular expression from examples which are interactively provided by a user, perhaps by selecting parts from a text or selecting begin or end markers. Is it pos...

Regular expressions Lexical Analysis

Why repeated strings such as [wcw|w is a string of a's and b's] cannot be denoted by regular expressions? pls. give me detailed answer as i m new to lexical analysis. Thanks ... ...

Error with two ways of linking boost regex

I understand that boost regex static library is created with the ar utility by archiving the individual object files. I linked boost regex library by using the -l option in gcc. This worked very well. g++ *.o libboost_regex-gcc-1_37.a -o sairay.out I individually compiled the boost regex source files and then tried to link the object...

What's a c# regular expression that'll validate currency, float or integer

I need a regex suitable for c# that'll validate a number if it matches: $1,000,000.150 $10000000.199 $10000 1,000,000.150 100000.123 10000 or the negative equivalents Anyone able to help? ...

escaping bracket in postgresql query

I am trying to escape a bracket in a pattern matching expression for PostgreSQL 8.2 The clause looks something like: WHERE field SIMILAR TO '%UPC=\[ R%%(\mLE)%' but I keep getting: ERROR: invalid regular expression: brackets [] not balanced ...

Python regex split a string by one of two delimiters

I wanted to cut up a string of email addresses which may be separated by any combination of commas and white-space. And I thought it would be pretty straight-forward : sep = re.compile('(\s*,*)+') print sep.split("""[email protected], [email protected] [email protected],,[email protected]""") But it isn't. I can't find a regex that won't leave some empty slots like thi...

Regular Expression patterns for Tracking numbers.

Does anybody know good place or patterns for checking which company tracking number is the given tracking number for a package. Idea is After scanning a barcode for a package check tracking number with patterns and show which company it was shipped by. ...

What does re.compile(r'[[]]') match?

With Python's re module, why do the following act differently: >>> r = re.compile(r'[][]') >>> r.findall(r'[]') ['[', ']'] >>> r = re.compile(r'[[]]') >>> r.findall(r'[]') ['[]'] >>> r.findall(r'][') [] ...

Remove SSN (Social Security Number) from a String in SQL.

I have a string in a MS 2000 SQL db and need to remove just the SSN using the select satement. I don't have the option of using an external app. The other fun part is that the locaton of the SSN is not always the same. [B-Day][First Name][SSN][POB] 12121970John123-45-6789Las Vages Or [B-Day][First Name][Last Name][SSN][POB] 12121970J...

Why do these javascript regex throw syntax errors?

I am trying to validate a text string as a date before processing it, however both of the regex i have tried are throwing syntax errors and I can't see why. From what I can tell there is nothing wrong with either. These are the strings: var datePattern1 = new RegExp( (0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])[-](19|20)\d\d ); and va...

Find Non-UTF8 Filenames on Linux File System

Hi, O/S = Fedora Code 9. I have a number of files hiding in my LANG=en_US:UTF-8 filesystem that have been uploaded with unrecognisable characters in their filename. I need to search the filesystem and return all filenames that have at least one character that is not in the standard range (a-zA-Z0-9 and .-_ etc.) I have been trying t...

Simple regex pattern

i'm using C# and i'm trying to allow only alphabetical letters and spaces. my expression at the moment is: string regex = "^[A-Za-z\s]{1,40}$"; my IDE says that \s is an "Unrecognized escape sequence" what am i missing? ...

regex help, please

I'm searching the pattern "(.*)\1" on the text "blabl" with regexec() and get successful match but empty matches in regmatch_t structures. What exactly has been matched? ...

Help with basic .htaccess mod_rewrite. (More defined)

This is a continuation of: http://stackoverflow.com/questions/623161/help-with-basic-htaccess-modrewrite I was told to use RewriteRule ^error/(.*) index.php?error=$1 [L] RewriteRule ^file/(.*) index.php?file=$1 [L] and RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ [NC] before each, but it dosn't really help me specifically. I am u...

Regex Question: Get Filename Without Extension in One Shot?In

I want to get just the filename using regex, so I've been trying simple things like ([^\.]*) which of course work only if the filename has one extension. But if it is adfadsfads.blah.txt I just want adfadsfads.blah. How can I do this with regex? In regards to David's question, 'why would you use regex' for this, the answer is, 'for f...

What regex will capitalize any letters following whitespace?

I'm looking for a Perl regex that will capitalize any character which is preceded by whitespace (or the first char in the string). I'm pretty sure there is a simple way to do this, but I don't have my Perl book handy and I don't do this often enough that I've memorized it... ...