regex

Remove a word on click with Jquery and Regex

Hi there I am looking for some help. I have found this script that sort of solves my problem 50% - I want to click on a word and delete the word using jquery similar to the example below. If using the example below it will highlight the word that you click on. <!DOCTYPE html> <html> <head> <style> p { color:blue; font-weight:bold; ...

Regular expression convert url to hyperlink

I've googled some code that converts an url into a hyperlink using bbcode The code is : // format the url tags: [url=www.website.com]my site[/url] // becomes: <a href="www.website.com">my site</a> exp = new Regex(@"\[url\=([^\]]+)\]([^\]]+)\[/url\]"); str = exp.Replace(str, "<a href=\"$1\">$2</a>"); // format the img tags: [img]www.web...

I am trying to create an expression that will extract URLs

I want to extract URLs from a webpage these are just URLs by themselves not hyperlinks etc., they are just text. Some examples would be http://www.example.com, http://example.com, www.example.com etc. I am extremely new at regex so I have copy and pasted like 20 expressions online all failed to work. I don't know if I am doing it right o...

PHP / regular expression to check if a string contains a word of a certain length

I need to check whether a received string contains any words that are more than 20 characters in length. For example the input string : hi there asssssssssssssssssssskkkkkkkk how are you doing ? would return true. could somebody please help me out with a regexp to check for this. i'm using php. thanks in advance. ...

Grab every css class name declared between curly braces using regex

Hi Im trying to write a simple CSS parsing script in PHP that enables me to put previously declared classes within a css rule, i.e. the Mixins functionality of less and Sassy. This regex only grabs the last css class name within the curly braces: {.+(\.\w+).+} For example, only .foo will be matched in the below css rule: .login_for...

How to use logical OR in SPARQL regex()?

I'm using this line in a SPARQL query in my python program: FILTER regex(?name, "%s", "i" ) (where %s is the search text entered by the user) I want this to match if either ?name or ?featurename contains %s, but I can't seem to find any documentation or tutorial for using regex(). I tried a couple things that seemed reasonable: FILT...

Python Regex (Search Multiple values in one string)

In python regex how would I match against a large string of text and flag if any one of the regex values are matched... I have tried this with "|" or statements and i have tried making a regex list.. neither worked for me.. here is an example of what I am trying to do with the or.. I think my "or" gets commented out patterns=re.compi...

bbcode unparser regex help

Hi, I have this function to parse bbcode -> html: $this->text = preg_replace(array( '/\[b\](.*?)\[\/b\]/ms', '/\[i\](.*?)\[\/i\]/ms', '/\[u\](.*?)\[\/u\]/ms', '/\[img\](.*?)\[\/img\]/ms', '/\[email\](.*?)\[\/email\]/ms', '/\[url\="?(.*?)"?\](.*?)\[\/url\]/ms', '/\[size\="?(.*?)"?\](.*?)\[\/size\]/ms', ...

Help Regular Expression

please see code : $result = "<b>Associated Names</b>&nbsp;&nbsp;[<a href='http://www.examples.com/authors.html?act=change&amp;id=6141&amp;item=associated'&gt;&lt;u&gt;Edit&lt;/u&gt;&lt;/a&gt;]&lt;/td&gt; </tr> <tr> <td class='text' align='left'>G&#12539;R<br />G-R<br /> </td>" preg_match_all("/<b>As...

Regex parse using Nokogiri

Using Nokogiri, I need to parse a block given: <div class="some_class"> 12 AB / 4+ CD <br/> 2,600 Dollars <br/> </div> So i need get AB, CD and Dollars values (if exist). ab = p.css(".some_class").text[....some regex....] cd = p.css(".some_class").text[....some regex....] dollars = p.css(".some_class").text[....some regex......

Approximate regular expression library for Java?

I have just written some code for approximate string matching. I would like to benchmark my naive algorithm against a more mature implementation running on the JVM. Any suggestions? ...

Error in regexp php

There is a mistake in this code, I could not find it. What is the missing character do I need? preg_replace(/<(?!\/?(?:'.implode('|',$white).'))[^\s>]+(?:\s(?:(["''])(?:\\\1|[^\1])*?\1|[^>])*)?>/','',$html); ...

Regex to determine if a file is a rar file

Hi all, i've been messing around trying figure this out myself but its taking a while.. Basically after a regex to pass the following tests: IsARarFile("test.rar"); // true IsARarFile("test.r00"); // true IsARarFile("test.txt"); // false IsARarFile("test.avi"); // false IsARarFile("test.mp4"); // false IsARarFile("test.001"); // true I...

Python: defining a union of regular expressions

I have a list of patterns like list_patterns = [': error:', ': warning:', 'cc1plus:', 'undefine reference to'] what I want to do is to produce a union of all of them yielding a regular expression that matches every element in list_patterns [but presumably does not match any re not in list_patterns -- msw] re.compile(list_patterns) ...

RegEx not working with look-aheads!

Hey guys, I am trying to match "address" in this page - http://www.bbb.org/norfolk/business-reviews/tax-return-preparation/liberty-tax-service-in-virginia-beach-va-48000604 The source of address part has this HTML <tr> <td align="right" class="generalinfo_left">Address:</td> <td class="generalinfo_right">1 S Main St Ste 1430<b...

Using regular expression for validating data is correct or not?

Hi, I have been finding some articles and post which suggest not to use the regular expression to validate user data. I am not sure of all the things but i usually find it in case of email address verification. So i want to be clear whether using regular expression for validating user input is good or not? if it is good then what is b...

regex and javascript

using http://www.regular-expressions.info/javascriptexample.html I tested the following regex ^\\{1}([0-9])+ this is designed to match a backslash and then a number. It works there If I then try this directly in code var reg = /^\\{1}([0-9])+/; reg.exec("/123") I get no matches! What am I doing wrong? ...

string mask and offset with regex

I have a string on which I try to create a regex mask that will show N number of words, given an offset. Let's say I have the following string: "The quick, brown fox jumps over the lazy dog." I want to show 3 words at the time: offset 0: "The quick, brown" offset 1: "quick, brown fox" offset 2: "brown fox jumps" offset 3: "fox jumps o...

zero width token??

I want to ask a very basic question about token, while reading about regex,the book tag caret(^) as a zero width token, can you please tell me what actually it means by zero width? ...

Exploding UpperCasedCamelCase to Upper Cased Camel Case in PHP

The title says it all. Right now, I am implementing this with a split, slice, and implosion: $exploded = implode(' ',array_slice(preg_split('/(?=[A-Z])/','ThisIsATest'),1)); //$exploded = "This Is A Test" Prettier version: $capital_split = preg_split('/(?=[A-Z])/','ThisIsATest'); $blank_first_ignored = array_slice($capital_split,1);...