regex

Regular Expression find a phrase not inside an HTML tag

Hi there, I'm struggling a bit with this regular expression and wondered if anyone was about to help me please? What I need to do is isolate the 1st phrase inside a string which is NOT inside an HTML tag. So the examples I have at the moment are: This is some test text about <acronym title="Incomplete Test Syndrome" class="CustomClass...

javascript regex question ?

I have following div: <div id = "zone-2fPromotion-2f" class = "promotion"> How can I get value 2f present in the end, actually it is the value of Promotion and how can I retrieve it ? I was using this.match = this.id.match(/(Promotion)-([0-9a-f]{2})/); but it is not giving me exact result but it gives me array of (Promotion-2f, ...

PHP: Is_numeric returns false on 0

Hi everyone, Is_numeric() as well as is_int() returns false if the value is 0. What can i do instead to verify that a specific value is numbers only in PHP? Are we heading straight for the Regular Expressions camp, or are there some nice, handy feature for this out there already? Thanks! ...

Regex Help matching quotes

Hi Guys, I havin a reg ex problemm i would like to have a reg ex that will match the '\nGO at the end of my file(see below.) I have got the following so far: ^\'*GO but its match the quote sysbol? EOF: WHERE (dbo.Property.Archived <> 1) ' GO ...

Can this be solved by using just regex?

I need to convert $text = 'We had <i>fun</i>. Look at <a href="http://example.com"&gt;this photo</a> of Joe'; [Edit] There could be multiple links in the text. to $text = 'We had fun. Look at this photo (http://example.com) of Joe'; All HTML tags are to be removed and the href value from <a> tags needs to be added like above. W...

Form validation in JAvascript with Regexp

I have a webpage with an input field where only digits are allowed. The input field has an onkeyup event that starts this validating function: function validate() { var uah_amount = document.getElementById("UAH").value; var allowed = /^\d+$/; document.getElementById("error").innerHTML = document.getElementById("UAH").value; ...

regular expression for decimal numbers?

I need a validation regex for decimal. It should allow upto 5 digits after decimal. Allow: 1 1.0 12.0 12.01 123.01 1,123.01 1,123.013 21,123.01234 3,21,123.01234 How Can I do regex for this? ...

Regex: How to leave out webding font characters?

Hi, I've a free text field on my form where the users can type in anything. Some users are pasting text into this field from Word documents with some weird characters that I don't want to go in my DB. (e.g. webding font characters) I'm trying to get a regular expression that would give me only the alphanum and the punctuation character...

sed: group capturing

Is there any way to tell sed to output only captured groups? for example given by input: This is a sample 123 text and some 987 numbers and pattern /([\d]+)/ I could get only 123 and 987 output in the way formatted by back references perhaps? ...

How come this RegEx isn't working quite right?

I have this RegEx here: /^function(\d)$/ It matches function(5) but not function(55). How come? ...

regular expression

I need regular expression to match braces correct e.g for every open one close one abc{abc{bc}xyz} I need it get all it from {abc{bc}xyz} not get {abc{bc} I tried this ({.*?}) ...

regular expressions: love or hate or alternatives?

While I can see the value and usefulness of regular expressions, I also find that they are extremely complicated and difficult to create and debug. I am often at the point where I find their usefulness is offset by the difficulty in creating expressions. I am a bit astonished by the fact that there is nothing quite like them and that t...

How can I catch an arbitrary string between defined words using regular expressions?

How can I catch an arbitrary string between defined words using regular expressions in .Net, e.g. @”…DEFINED_WORD1 some_arbitrary_string DEFINED_WORD2…”? Unfortunately my experiments with “(?=)” and other patterns are unsuccessful :( ...

how can i use RegExp to grap data from this site ?

i want to grap data from this site by regexp http://aymanalrefai.wordpress.com/2010/03/15/596/ i tried this /<div class="entry">.*?<p class="postinfo">/is but it didn't give me a correct result any help ? ...

How do I match number from 0 to 255 using regex in PHP?

/[0-9]+/ will also match those out of range,like 999 How to write an regex that matches exactly numbers between 0~255 ? ...

Get all email addresses in a string with JavaScript

So, I have this JavaScript function: ME.Utils = { RxEmail: new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0...

How to extract text using regex in Actionscript?

In the HTML below: <a href="link1.php">1</a><a href="link2.php">2</a><a href="link3.php">3</a> How do I extract link1.php,link2.php,link3.php and push them into an array using regex? (There could be N number of <a> tags in the text) [Edit] I'm aware the regex for this is something like href="([^"])*". But I'd like to know how to go a...

How do I create a regular expression to match a word misspelling the original case sensitivity?

I want to discover wrong spelling of "FooBar" in sentence: "This is a 'FooBar' example where I should match different spelling of fooBar such as: foobar, FOOBAR or even fOoBaR but not foobarS!" In this sentence, I would like to match words (in order): fooBar, foobar, FOOBAR, fOoBaR and not: FooBar (correct spelling), foobarS (not the s...

jQuery wildcard selection

Suppose you have some <div>s: <div id="div_num1"></div> <div id="div_num2"></div> <div id="div_num3"></div> You can select all those divs by choosing $("div[id^='div_num']"). How can you buld a function that references the number succeeding the prefix? For example, a function which will alert the number 3 for "div_num3". More genera...

find and replace tokens in javascript

Hello, I have to do something like this string = " this is a good example to show" search = array {this,good,show} find and replace them with a token like string = " {1} is a {2} example to {3}" (order is intact) the string will undergo some processing and then string = " {1} is a {2} numbers to {3}" (order is intact) to...