regex

Parse A Steet Address into components

Does anyone have a php class, or regex to parse an address into components? At least, it should break up into these components: street info, state, zip, country ...

Please explain this regex

I have regex which reads: @"<img\s*[^>]*>(?:\s*?</img>)? Can someone please explain this part: (?:\s*?)? What is that? ...

Remove the object tag from my html

I'm trying to remove the object tag from a text file: <object classid=""clsid:F08DF954-8592-11D1-B16A-00C0F0283628"" id=""Slider1"" width=""100"" height=""50""> <param name=""BorderStyle"" value=""1"" /> <param name=""MousePointer"" value=""0"" /> <param name=""Enabled"" value=""1"" /> <param name=""Min"" value=""0"" /> <p...

Regex to capture JPG images only

I have this regex in PHP: $regex = '/<img[^>]*'.'src=[\"|\'](.*)[\"|\']/Ui'; It captures all image tag sources in a string, but I want to only capture JPG files. I've tried to mess around with (.*) but I've only proven that I suck at regex... Right now I'm filtering the array but feels too much like a hack when I can just do it straig...

How do we retrieve the pattern subset using regular expression in javascript?

<script type='text/javascript'> var str="('apple',16),('orange',7),('banana',12)"; var pattern=/\('([^']+)',([0-9]+)\)/gi; var reg=new RegExp(pattern); var arr=str.match(reg); document.write(arr); </script> In the above javascript, I used two pairs of brackets in the pattern to indicate the data I want to get from the string. Obvio...

RegEx: Link Twitter-Name Mentions to Twitter in HTML

I want to do THIS, just a little bit more complicated: Lets say, I have an HTML input: <a href="http://www.example.com" title="Bla @test blubb">Don't break!</a> Some Twitter Users: @codinghorror, @spolsky, @jarrod_dixon and @blam4c. You can't reach me at [email protected]. Is there a good RegEx to replace the twitter username mentio...

required and regular expression for float datatype

Hello All, I want to validate the field whose datatype is float in the database.Please tell me the required expression and regular expression for the float datatype so that user can enter only the digits in float. for example this is giving error else if(!Regex.IsMatch(lowerlimit, @"[+-]?(?:(?:\d+\.\d*)|(?:\d*\.\d+))")) { ...

Why is this regex not working properly?

I have this regex: ^\/\* to check and see if a file contains those two characters at the beginning. I'm iterating over many c++ source files trying to see which of them contain that. The problem is, that if a file contains this: #include <source.h> /* this is a comment */ this also matches the regex. I don't understand why, as the re...

regex for all characters on yahoo pipes

I have an apparently simple regex query for pipes - I need to truncate each item from it's (<img>) tag onwards. I thought a loop with string regex of <img[.]* replaced by blank field would have taken care of it but to no avail. Obviously I'm missing something basic here - can someone point it out? The item as it stands goes along some...

Regex matchin string that containts at least one specific character

I'm trying to create an expression that matches anything between two whitespaces that does contain at least one - but have no f** idea how to do that. Trying things like (?<=\s)[A-Z0-9(\-)+]+(?=\s) don't work at all... Has anybody a good idea? ...

Increment a number in a string in with regex

I get the name of an input element, which is a string with a number (url1). I want to increment the number by 1 (url2) in the easiest and quickest way possible. My way would be to get \d / restofstring, ++ the match, then put together number with restofstring. Is there a better way? Update: My final (dummy)code became: var liNew = do...

How to get good perfomance of Regex in java

Below is example of text: String id = "A:abc,X:def,F:xyz,A:jkl"; Below is regex: Pattern p = Pattern.compile("(.*,)?[AC]:[^:]+$"); if(p.matcher(id).matches()) { System.out.println("Hello world!") } When executed above code should print Hello world!. Does this regex can be modified to gain more performance? ...

Dreamweaver regular expression substitution followed by number

Hi. I'm using Dreamweaver to update copyright dates across my site. I want to preserve the existing spacing (or lack thereof) between years. Examples: 2002-2008 should update to 2002-2009 2003 - 2008 should update to 2003 - 2009 This is the regular expression I'm using to accomplish this in Dreamweaver's find & replace function Fi...

Axapta Validation Class

I've written a method to handle regex validation in AX2009. Problem is that it always returns false, no matter what the expression or input string. Returns no errors, just 'false' Mind taking a look? I'm probably missing something simple. This post has been updated to included the corrected method, without the error, so you can cut ...

Need help to modify this complex regular expression

Hi, I am using ExtJS. One of the textfield made with ExtJS component should allow comma separated number/opeator strings (3 similar examples) like 1, 2-3, 4..5, <6, <=7, >8, >=9 2, 3..5, >=9,>10 <=9, 1, <=8, 4..5, 8-9 Here I am using equals, range (-), sequence (..) & greater than/equal to operators for numbers less than or eq...

AS3 regex split

I want to split a number using regex. I have a number like xyz (x and y are single digits, z can be a 2 or three digit number), for example 001 or 103 or 112. I want to split it into separate numbers. This can be done, if I'm not wrong by doing split("",3); This will split the number (saved as string, but I don't think it makes differen...

how to detect links in a string using RegEx in as3 ?

I am trying to find the generic links in strings. I've found a very handy regex on RegExr, in the community expressions: (https?://)?(www\.)?([a-zA-Z0-9_%]*)\b\.[a-z]{2,4}(\.[a-z]{2})?((/[a-zA-Z0-9_%]*)+)?(\.[a-z]*)?(:\d{1,5})? I tried to use it and it returns null, although the same string tested on RegExr works fine: var linkRegEx:...

Regex for a-z, 0-9, . and -

Can someone tell me what the syntax for a regex would be that would only allow the following characters: a-z (lower case only) 0-9 period, dash, underscore Additionally the string must start with only a lower case letter (a-z) and cannot contain any spaces or other characters than listed above. Thank you in advance for the help, Jus...

Find and Replace in VS 2008/2010

Hi everyone, I'm just trying to remove spaces from some line: "(jan | feb | mar | apr | may | jun | jul | aug | sep | oct | nov | dec)\.(\s+),(\s+)(\d{4})" in my solution and try to do that with find and replace and somewhat don't know how to enter space character in this dialog box. And as I started with some regx what is the differe...

regex to strip out [blah: ... ] tag from string

I am using this regex: [Blah(?:\s*)\] I want to strip out the tag that looks like: [Blah:http:..anyting goes here so catch all types of characters ] Any tips on what's wrong with my regex? ...