regex

backslash in regex in xsd with xjc (ant) and jaxb validation

Hi, I have the following regex type in my xsd file: <xsd:simpleType name="Host"> <xsd:restriction base="xsd:string"> <xsd:pattern value="\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"> </x...

Extract pattern substring from NSString

Hi, I've created my own UITabBarController. Additionally I've written a few lines of code to determine the current user. E.g. if I am the current user do/display this, otherwise do/display this etc... The format pattern is (firstname Lastname). The Full name of the current user is in "displayName". This is how I set the title of th...

Regex to remove all functions from a js file [Textmate preferred]

I'm working on a large and extremely messy javascript file, and I would like to remove all functions from the file, ultimately creating a version which contains only data. the code looks something like this: var foo : bar = "hi"; function foobar (){ //blah blah } var fobar:bar; var barfo:bar; function imSoUgly(){ //Blah blah blah b...

please help about regular expresion

What's wrong with this expression? ^[a-zA-Z]+(([\''\-][a-zA-Z])?[a-zA-Z]*)*$ I want to allow alpha characters with space,-, and ' characters for example O'neal;Jackson-Peter, Mary Jane ...

Regular Expression match

Hello, I'm trying to create a regular expression to match some certain characters, unless they appear within two of another character. For example, I would want to match abc or xxabcxx but not tabct or txxabcxt. Although with something like tabctxxabcxxtabcxt I'd want to match the middle abc and not the other two. Currently I'm trying ...

Remove empty tags using RegEx

I want to delete empty tags such as <label></label>, <font> </font> so that: <label></label><form></form> <p>This is <span style="color: red;">red</span> <i>italic</i> </p> will be cleaned as: <p>This is <span style="color: red;">red</span> <i>italic</i> </p> I have this RegEx in javascript, but it deletes the the empty tags but ...

Javascript, Regex - I need to grab entries with parameters, potentially across multiple lines

Based on my previous question, I've come up with a better way to approach my problem. Here's what I have in mind: I want to start extracting word/space characters up to the first occurrence of a pipe ('|') delimiter, or else a newline. Trim whitespace at either end. This extraction will be the start of a new "entry". For each pipe f...

Lazy Regex Match in .NET. What's wrong here?

Hi! In the following example I would like to retrieve the text between pMAINp and the first pMDSp. The regex has a look-behind and a look-ahead: string contents = "pMAINp MAP B FlightTest Load pMDSp ZutiCarrier pWingp some pMDSp more pWingp end"; string blockMainRegex = @"(?<=pMAINp)[\s\w+]+(?=(pMDS)?)"; The result I was hoping for w...

^[\x20-\x7E]{8,127}$ except backslash

I want to add one condition 'except backslash' to /^[\x20-\x7E]{8,127}$/ how can I do? ...

Python Conditional Regular Expression

This is a question involving a conditional regular expression in python: I'd like to match the string "abc" with match(1)="a" match(2)="b" match(3)="c" but also match the string " a" with match(1)="a" match(2)="" match(3)="" The following code ALMOST does this, the problem is that in the first case match(1)="a" but in the secon...

Custom Taxonomy + Custom Post Type in Wordpress Permalinks ?

Is it possible to get a Wordpress URL to look like this: /%post-type%/%custom-taxonomy%/%postname%/ I can get everything but the middle. Any ideas? ...

Regular Expression for Wright Express?

There is plenty of info available about regular expressions for credit card numbers (for example http://www.regular-expressions.info/creditcard.html). However I have not been able to find info on the regular expression (or any other description) for the number used by Wright Express (which I think is some kind of fuel card). Does anyone ...

Regex I copied into my Rails model won't work?

Brand spanking new to Regex in Rails so please be gentle... I found the following on Regexlib.com to validate no spaces. ^[a-zA-Z]+$ But when I put it into validates_format_of :first_name, :with => ^[a-zA-Z]+$ I get an error saying unexpected tCARET. What's the problem? ...

C# how to Parse stored procedure String

Hi. I have a Query string from client application. It comes with all parameters like string query="PROCS.DBO.APP_2370_ANALYST_S 'ABC' , 'TESTDATA' , 100"; In Server, I made a function(Util.getParametersFromString) to parse string from client application to make parameter object Array using string.Split function. I used ',' and ...

Strong password regex

I need strong password validation regex Special Characters - Not Allowed Spaces - Not Allowed Numeric Character - At least one character At least one Capital Letter Minimum and Maximum Length of field - 6 to 12 Characters Repetitive Characters - Allowed only two repetitive characters my Regex is ^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s...

Regex Expression & string In C# Question.

Hello. I want to split my string s1 = 6/28/2010 4:46:36 PM and s2 = 16:46:36.5013946 . and concatenate them to new s3 = 20010062816463650. But when I split s2. my regex doesn't work. I was paused now. using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; namespace ConAppTest { c...

Java regular expression needed to separate phone number and text in brackets

Hi all, I'd like a regular expression for Java that can take this string +1 7183541169 (East coast) And produce two groups +1 7183541169 East coast I'm having difficulty with escaping the round brackets. ...

Is it possible to generate an example string based on a regex pattern?

Dear reader, In my application the user can enter his own regex pattern into a text box so he can force a certain input for another user/text box. Is it possible for the user to see an example of a string that would match the regex he has entered? For example if he was to enter: ^[A-Z]{2}$, it would generate a string like "XX" to show t...

Getting an ID out of a string. Regex problem.

I am trying to get the ID from a URL string. I'm trying with the following code:- FROM: <url>http://www.monkeys.com/monkey.php?id=24&lt;/url&gt; I want to get '24' with:- $ID = preg_replace($url, '/^<url>.*\?id=(.*)<\/url>$/', '\1'); Any help would be much appreciated - i'm sure this is a regular problem, but I find regex bafflin...

Validating string using ruby Reg Expressions?

Hi how can i validate that the date and time in the following string is in the right format i.e year, month, day and then the time(4 digits, 2 digits, 2 digits and then the time) "Event (No 3) 0007141706 at 2010/04/27 11:48 ( Pacific )" thanks ...