regex

Having trouble creating .NET Regex pattern to capture multiple line text

Sample text is as follows - it is part of a much larger document that is being parsed (each line has trailing spaces prior to its end): Procedure Information Primary Procedure: LAPAROSCOPIC PARTIAL LEFT NEPHRECTOMY /ROBOTIC WITH ...

How do I make a regex not 'swallow' a character?

I have a text file like so {word} definition {another word} another definition {word} they don't have to be on different lines The regex I was using was $regex = '/\{([a-z]+?)\}(.+?)\{/i'; This however, causes problems in that it swallows the last brace {, and then it won't match the next { in the next word. To demonstrate, I ...

How to run a query with regexp in Android

I want to run a query in SQLite with a regexp using Android. How do I do that? ...

How do I make this regex more general, sometimes it works and sometimes it doesn't

I have the following regex that I am using in a java application. Sometimes it works correctly and sometimes it doesn't. <!-- <editable name=(\".*\")?> -->(.*)<!-- </editable> --> Sometimes I will have whitespace before/after it, sometimes there will be text. The same goes for the region within the tags. The main problem is that name...

How to parse for tags with '+' in python

I'm getting a "nothing to repeat" error when I try to compile this: search = re.compile(r'([^a-zA-Z0-9])(%s)([^a-zA-Z0-9])' % '+test', re.I) The problem is the '+' sign. How should I handle that? ...

RegEx and QueryString

Hello, i have this regex that i use with my website ^.*/([a-z0-9,-]+)/([a-z0-9,-]+)/$ My question is who i can use querystring with my regex, /about-us/contact/?l=en -> page.aspx?id=12&l=en where id=1 = /about-us/contact/ where l=en = /?l=en Hope you understand, Thanks for help :) ...

i'd like to create from a simple XML text SQL using RegExp

just simple, I have such data, thousands of <MigratedData> elements, normally we load them using XMLLoader application, but this is a special case now, I have to update the database myself using the mapping: <MigratedData> <migrationNr>12123456</migrationNr> <idOldSystem>33398088801</idOldSystem> </MigratedData> <Migrate...

Give up with regular expressions

Hi all I have this html with this type of snippit below all over: <li><label for="summary">Summary:</label></li> <li class="in"> <textarea class="ta" id="summary" name="summary" rows="4" cols="10" tabindex="4"> ${fieldValue(bean: book, field: 'summary')}</textarea> <a href="#" class="tt"> <img src="<g:createL...

preg_replace(), and the abbreviations that go with it?

I've recently been working with a simple Twitter API for PHP and came across this code to make @username be linked with twitter.com/username. Unfortunately this code creates it so @username links to http://twitter.com/@username, resulting in error. There are many parts to this code I do not understand, such as ^\v and others (seen belo...

Regex problem

Hello, I'm trying to remove the CDATA wrapper in the following script (content has to be wrapped by CDATA to pass XHTML validation): <script id="tplTest" type="text/html"> //<![CDATA[ <p id="msg">Hello</p> <p>Another test: <#= ddd.ArtID #></p> //]]> </script> This js script: var strTmp=document.getElementById("tplTest").innerHTML...

Replace text, Jython, Regex

Hey, I am processing my website and wanting to change some things on the pages. I am wanting to replace the following string: in the <SPAN class="Bold"> More... </SPAN> column to your right. Some times is does not have the <span> tags : in the More... column to your right. I would like to replace this with "below". I tried doing...

RegEx to randomly set case of characters in a string

What I'm looking for is a RegEx to mix the character case of a given string for use in functional testing. Example Input: The Quick Brown fox jumps over the Lazy Dog. Sample Expected Output: tHe QUiCk BrOwn FoX jUMPs OvER tHe lAzY dOg. It would be nice if the output was different every time the RegEx were applied. For example, giv...

Looking for a regex - 8 char min w/ 1 num and 1 char

I'm looking for some help creating a regex that requires 8 char (at a minimum) along w/ 1 number and 1 char (not special char). example: a1234567 is valid but 12345678 is not Any help for a regex newb? EDIT: Thanks for the quick replies- the implementation that worked in VB is shown below Dim ValidPassword As Boolean = Regex.IsMatch...

Visual Studio Regex '?'

MSVS: Where's the regex ? I have code that I'm trying to match with a regular expression in MSVS 2008, but I can't figure out the regex for it. Take the classic example: colou?r ...which is a regular expression that matches color or colour. This matches neither in MSVS. Referring to the help file, I cannot find ?. This wouldn't be a...

Help with regular expression with mod_rewrite

Hi, I have links like these that I want to change: mypage.com?page=missions&id=5 mypage.com?page=hello I tried to change them into easier links with this: Options +FollowSymLinks RewriteEngine On RewriteRule ^([^/]*)/([^/]*)$ /index.php?page=$1&id=$2 [L] It works but if I want to access pages like (mypage.com?page=hello) I have to ...

MySQL - fetch rows where first character is not alphanumeric

I am adding a few new features to a small project i'm working on and one of them is alpha pagination which looks like # 0-9 A B C D E ... X Y Z I can easily fetch items by their first letter using something like SELECT * FROM ... WHERE name LIKE 'A%' ... Grouping everything that starts with a number and all other characters is a...

regex for alphanumeric, but at least one character

Hi, In my asp.net page, I have an input box that has to have the following validation on it: Must be alphanumeric, with at least 1 character (i.e. can't be ALL numbers). ...

Regular expression to delete HTML strings

I am trying to delete part of a string that does not match my pattern. For example, in <SYNC Start=364><P Class=KRCC> <Font Color=lightpink>abcd I would like to delete <P Class=KRCC><Font Color=lightpink> How do I do that? ...

How can I convert a Perl regex with named groups to Python?

I am trying to convert the following Perl regex I found in the Video::Filename Perl module to a Python 2.5.4 regex to parse a filename # Perl > v5.10 re => '^(?:(?<name>.*?)[\/\s._-]*)?(?<openb>\[)?(?<season>\d{1,2})[x\/](?<episode>\d{1,2})(?:-(?:\k<season>x)?(?<endep>\d{1,2}))?(?(<openb>)\])(?:[\s._-]*(?<epname>[^\/]+?))?$', I would ...

What is the scope of $1 through $9 in Perl?

What is the scope of $1 through $9 in Perl? For instance, in this code: sub bla { my $x = shift; $x =~ s/(\d*)/$1 $1/; return $x; } my $y; # some code that manipulates $y $y =~ /(\w*)\s+(\w*)/; my $z = &bla($2); my $w = $1; print "$1 $2\n"; What will $1 be? Will it be the first \w* from $x or the first \d* from ...