Possible Duplicate:
What is a regex independent capturing group?
Which is the difference between:
(?:X) X, as a non-capturing group and
(?>X) X, as an independent,
non-capturing group
I can't figure out how to use the last.
...
Ok so i've made this function which works fine for converting most urls like pies.com or www.cakes.com to an actual link tag.
function render_hyperlinks($str){
$regex = '/(http:\/\/)?(www\.)?([a-zA-Z0-9\-_\.]+\.(com|co\.uk|org(\.uk)?|tv|biz|me)(\/[a-zA-Z0-9\-\._\?&=#\+;]+)*)/ie';
$str = preg_replace($regex,"'<a href=...
hi, i have a phrase like this
Computer, Eddie is gone to the market.
I want to get the word Eddie and ignore all of the other words since other words are constant, and the word Eddie could be anything.
How can I do this in regular expression?
Edit:
Sorry I'm using .NET regex :)
...
Hello everybody,
I am working on a loginMiddleware class for Django. This middleware class must send a user to the login page when it's not logedin. But there are a few exceptions.
Because i run the build-in django server i had to make a media url. But know is de problem that when the login page loads a javascript file, the javascript...
how to i replace
Apple 123456
to
Apple 1|Apple 2|Apple 3|Apple 4|Apple 5|Apple 6
by php pcre?
...
To validate names that can be
John, John Paul, etc.
I use this regex:
String regex = "[A-Z]([a-z]+|\\s[a-z]+)";
but when I do:
boolean ok = Pattern.matches(regex, "John Paul");
the matches fail?
Why? I want to use matches to validate the string as whole...
Is that regex wrong?
...
Hello,
I'm quite new to Perl development, and I'd like to perform a following task:
My script receives hex-encoded string as command-line param. Then I must decode this string and write it to output file like a C++ array with initialization from data given. For example:
perl myscript.pl DEADBABEDEADBEEF
and the output something like
...
Possible Duplicate:
php regular expression help?
hi,
i want to replace
i like apple
apple is good
orange is also nice
my mom likes banana
apple 123 4
the pear is soo sweat
my dad loves pear
to
i like apple
apple is good
orange is also nice
my mom likes banana
apple 1
apple 2
apple 3
apple 4
the pear is soo sweat
my dad lo...
Hi,
I've been struggling with this for a while now so hopefully someone can help me out. I need to use regex to replace all spaces inside an anchor tag for example.
Hello this is a string, check this <a href="http://www.google.com">Google is cool</a> Oh and this <a href="http://www.google.com/blah blah">Google is cool</a> That is al...
based on this post link text
i came up with a regex for javascript
\b(([\w-]+:\/\/?|[\w\d]+[.])?[^\s()<>]+[.](?:\([\w\d]+\)|([^`!()\[\]{};:'".,<>?«»“”‘’\s]|\/)))
this one matches urls like
http://google.com
http://www.google.com
google.com
and fail for
google
but when i used japanese characters like
功功.jp
...
I got some idea from a C# related thread, but I need it in Javascript. I am try all sorts of things, it doesn't seem to work.
name.replace(/[A-Z]/g, / $&/);
What I am trying to do is make:
FirstName
with spaces:
First Name
But what I get is:
/ F/irst/ N/ame
Any ideas would be much appreciated.
...
I am looking to match strings out of a file that are prefixed
/**
and have a postfix
*/
With any number of characters/whitespace/newlines in between.
eg:
/** anything
anything
*/
I have m/(\/\*\*).*?(\*\/)/ so far, however this does not handle newlines. I know the fix has to be simple, but i have very limited regular exp...
Hi
Is it possible to have a single but recurring regex.replace call?
e.g.
string dateText = "01\.02\\.2008";
string dateSeperators = @"\.|/|\\|-";
string result = Regex.Replace(dateText, dateSeperators, "."); // needs to be fixed. single call possible?
The result should give "01.02.2008".
Currrently i need 2 runs, first run the above...
Hi,
I need a regular expression for my rails application for password field.
any character or number or symbols is allowed except space.
Thanks!
...
I have some HTML that looks like this:
$(document).ready(function(){
$('#cumulative-returns').graph({
width: 400,
height: 180,
type: 'bar',
x_label: 'Month',
x_data: ['Jan','Feb','Mar','Apr'],
y_label: 'Cumulative Return',
y_data: ['5','10','...
When you're iterating over hundreds of lines in a file, what is the most (and least) efficient way to run regular expressions in Python?
Specifically, is the following bad form?
for line in file:
data = re.search('(\d+\.\d+)\|(-\d+\.\d+)\|(.*?)\|(.*?)\|(\d+:\d+\s+\w+)\sTO\s(.*?)',line)
one = data.group(1)
two = data.group(2)
th...
$text = "<p>keep me</p> <p>strip me </p>
$pattern = "/<[^\/>]*>(\ \;)*<\/[^>]*>/";
$text = preg_replace($pattern, '', $text);
Hi, I need to strip "quasi-empty" p tags from a html string. there's always only a as a trigger in the p element. how can I strip it with regex?
...
I'm trying to validate some fields before persisting them to the database. In particular, I need to know that a String contains a non-whitespace character.
I'm using the javax.validation.constraints.Pattern annotation, as follows:
@Pattern(regexp = "[^\\s]")
private String field;
This seems to throw the ConstraintViolation on every ...
I'm writing a program which uses regex to match incoming data. The regex works on the computer I'm coding on, but it doesn't work on the client computer I'm testing on. It works on my computer in debug mode, release mode, and being run straight from the bin. What could possibly make a regex work differently?
Regex:
const string _patter...
Can some please help me to rewrite these code:
if (eregi($asked,$accepted)) {
$this->plot_type = $which_pt;
return true;
} else {
$this->DrawError('$which_pt not an acceptable plot type');
return false;
}
Any help will be highly appreciated, I have tried all the fix I got through Google but none has been able to fix it.
Thanks.
...