i'm using this regex
((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»“”‘’]))
to match urls (found here http://daringfireball.net/2010/07/improved_regex_for_matching_urls it's the bottom one) and when i use match i...
Hi All,
So I'm using Wordpress' database object to store things into tables. One of the drawbacks (or advantages, depending on how you look at it) is that it escapes the single and double quote characters so that:
' --> \'
" ---> \"
What regex can I apply to the output to replace all \' with ' and \" with "?
...
Hello,
I'm getting this odd error in the preg_match() function:
Warning: preg_match(): Compilation failed: range out of order in character class at offset 54
The line which is causing this is:
preg_match("/<!--GSM\sPER\sNUMBER\s-\s$gsmNumber\s-\sSTART-->(.*)<!--GSM\sPER\sNUMBER\s-\s$gsmNumber\s-\sEND-->/s", $fileData, $matches);
Wh...
Need a regular expression to validate number with comma separator.
1,5,10,55 is valid but 1,,,,10 is not valid.
...
on a given page there are bunch of elements:
<div class="some class"> <-- here is anything, other divs, even other divs with
the same class, but I need to match right on closing tag for this particular
opening tag --></div>
...
Hello, I've a Ruby regexp question.
if string == /(^\d{1,3})/ # this matches both "24" and "24 gravida ut aliquam"
# code...
end
I want the regexp to match only "24".
How should I do to only allow digits?
...
Hello.
I need help with a RegEx problem:
I want to find occurences of two known words ("foo" and "bar" for example), that have any white space other than EXACTLY ONE SPACE CHARACTER between them.
In the text that I have to grep, there may be spaces, tabs, CRs, LFs or any combination of them between the two words.
In RegEx words:
I ne...
I have discovered that the following PHP code crashes when it runs on a Windows Apache server:
<?php
$test = "0,4,447,11329,316,415,142,5262,6001,9527,11259,11236,1140,9770,9177,9043,11090,268,5270,9907,9196,10226,".
"9399,1476,9368,6929,1659,11074,10869,8774,739,11344,10482,6399,8910,8997,11198,137,10148,10371,5128,767,2483,"....
I would like to validate my users, so they can only use a-z and - in their username.
validates_format_of :username, :with => /[a-z]/
However this rule also allows _ - and capital letters. How do I only allow letters, numbers, _ and -?
...
I'm trying to capture certain parts of HTML using regular expressions, and I've come across a situation which I don't know how to resolve.
I've got an HTML fragment like this:
<span ...> .... <span ...> ... </span> ... </span>
so, a <span> element into which another <span> element is nested.
I've been successfully using the followin...
I'm having troubles to create a regular expression who checks if a file has the extention .TMP so the pattern should accept any string who's not equal to (a-z 0-9 or event dots).TMP
To be clear: the matcher should only be succesfull when the file doesn't have the TMP extention.
I've allready found that I need to use (?!expression) for ...
I want to replace the below statement
ImageIcon("images/calender.gif");
with
ImageIcon(res.getResource("images/calender.gif"));
Can anyone suggest a regex to do this in eclipse.Instead of "calender.gif" any filename can come.
...
Hello, I need to use a regular expression that contains all the \b characters except the dot, .
Something like [\b&&[^.]]
For example, in the following test string:
"somewhere deep down in some org.argouml.swingext classes and"
I want org.argouml.swingext string to match but org.argouml string not too match. (Using the Matcher.find(...
HTML code example:
<meta http-equiv="Content-type" content="text/html;charset=utf-8" />
I want to use RegEx to extract the charset information (i.e. here, it's "utf-8")
(I'm using C#)
...
I'm having trouble with a regular expression in PHP that uses a potentially empty backreference. I was hoping that it would work as explained in http://www.regular-expressions.info/brackets.html:
If a backreference was not used in a
particular match attempt (such as in
the first example where the question
mark made the first ba...
I have three virtual hosts - 1. development -> 2. staging -> 3. live
I want staging.mywebsite.com to point to the staging virtual host, for the live I want mywebsite.com and www.mywebsite.com to point to the live one etc., and then for *(everythingelse).mywebsite.com needs to point to the development server.
Anyone have any idea?!
...
hello,
i need to extract an certain part from an string using java
ie i have a string completei4e10
i need to extract the value which is inside i and e - i.e. "4" completei 4 e10
using regex....
...
I'm using spring for setting my regular expression
spring:
<property name="regularExpressionAsString" value="(?<!\\.TMP)\\Z" />
code:
public void setRegularExpressionAsString(String regularEx) {
this.regularExpression = Pattern.compile(regularEx);
}
This doesn't work properly and when I debug my setter I've seen that spring...
In Perl, how can I use one regex grouping to capture more than one occurrence that matches it, into several array elements?
For example, for a string:
var1=100 var2=90 var5=hello var3="a, b, c" var7=test var3=hello
to process this with code:
$string = "var1=100 var2=90 var5=hello var3=\"a, b, c\" var7=test var3=hello";
my @ar...
Hi all,
Does anybody know how to replace the HTML entity for dumb (straight) double quote marks (") with curly typographic html entites - “ and ” respectively?
I only know the basics of regex at the moment and was hoping that there were some good dreamweaver find-and-replace tutorials but so far have found nothing usef...