Can someone give me a regular expression that will verify if all the letters in the word "cat" were also in the word "coating" in the proper sequence? So for the word "coating", the RegEx will test true for "cat" but false for "act".
...
This was a fascinating debugging experience.
Can you spot the difference between the following two lines?
StringReplace["–", RegularExpression@"[\\s\\S]" -> "abc"]
StringReplace["-", RegularExpression@"[\\s\\S]" -> "abc"]
They do very different things when you evaluate them. It turns out it's because the string being replaced in the ...
I need to replace "x y z word1 word2" with "x_y_z word1 word2"
The number of single characters may vary.
...
Hi, I am trying to refine a preg_match_all by finding the second occurrence of a period then a space:
<?php
$str = "East Winds 20 knots. Gusts to 25 knots. Waters a moderate chop. Slight chance of showers.";
preg_match_all ('/(^)((.|\n)+?)(\.\s{2})/',$str, $matches);
$dataarray=$matches[2];
foreach ($dataarray as $value)
{ echo $val...
Hi
I am writing an application in java I need to fetch specific data from website.I do not know which one to use whether REGEX or Parser.Can anybody please advise me how to get this done? and which one is prefered.
Thanks
...
I want to retrieve the consecutive 8 digits out of a string.
"hello world,12345678anything else"
should return 12345678 as result(the space in between is optional).
But this should not return anything:
"hello world,123456789anything else"
Because it has 9 digits,I only need 8 digits unit.
...
I don't know if I can use regex for this, but I want to replace something in this xml:
<custom-attribute name="Attribute_1" dt:dt="string">Danny Boyle</custom-attribute>
<custom-attribute name="DVD-releasedatum" dt:dt="string">06/10/1999</custom-attribute>
should become
<Attribute_1>Danny Boyle</Attribute_1>
<DVD-releasedatum>06/10/1...
Why is it counter intuitive?
/(?<!\d)\d{8}(?!\d)/,here (?<!\d) comes first,but called lookbehind,(?!\d) next,but called lookahead.All are counter intuitive.
What's the reason to name it this way?
...
I really don't understand regular expressions and was wondering what the following regular expressions do I wanted my address and name to except periods hyphens letter uppercase and lowercase and numbers.
Is my regular expressions living up to there job and is there need for improvement? Plus if some one can break down the regular expre...
Im really really a newbie in regexp and I can’t figure out how to do that.
My goal is to have the RewriteRule to 'slice' the request URL path in 3 parts:
example.com/foo
#should return: index.php?a=foo&b=&c=
example.com/foo/bar
#should return: index.php?a=foo&b=bar&c=
example.com/foo/bar/baz
#should return: index.php?a=foo&b=bar&c=ba...
Will this email validation allow foreign email address like russian, hebrew and so on? And how can I just check for the @ sign?
Here is the php code.
if (preg_match ('/^[\w.-]+@[\w.-]+\.[A-Za-z]{2,6}$/', $_POST['email'])) {
$email = mysqli_real_escape_string($mysqli, strip_tags($_POST['email']));
} else {
echo '<p class="error"...
I want a regex expression which only match extensionless url. In otherwords if an extension is present in url then completely ignore it.
/(.+)/(.+) this will match an URL both with and without extension.
www.site.com/sports/cricket should match
www.site.com/sports/cricket.aspx shouldn't match
Thanks in advance
...
What will be proper regular expression for git repositories?
example link:
git@github.com:someone/someproject.git
so it will be like
server can be url or ip
Project can contain some other characters than alphanumeric like '-'
I'm not sure what is the role of '/'
any suggestions?
...
Hi,
I'm a relative novice to regular expressions (although I've used them many times successfully).
I want to find all links in a document that do not end in ".html"
The regular expression I came up with is:
href=\"([^"]*)(?<!html)\"
In Notepad++, my editor, href=\"([^"]*)\" finds all the links (both those that end in "html" and thos...
I'm struggling with regex for splitting logs files into log sequence in order to match pattern inside these sequences.
log format is:
timestamp fieldA fieldB fieldn log message1
timestamp fieldA fieldB fieldn log message2
log message2bis
timestamp fieldA fieldB fieldn log message3
The timestamp regex is known.
I want to extract eve...
I would like to be able to check a string of text and extract a twitpic url if it is present in the string, ultimately I would like just the code portion, but either will do.
Example:
"blah blah blah http://twitpic.com/1aso4q blah blah"
Desired result:
http://twitpic.com/1aso4q
or
1aso4q
Anyone able to help?
...
I'm looking for a way to modify my .hgignore file to ignore all "Properties/AssemblyInfo.cs" files except those in either the "Test/" or the "Tests/" subfolders.
I tried using the negative look-behind expression
(?<!Test)/Properties/AssemblyInfo\.cs$, but I didn't find a way to "un-ignore" in both folders "Test/" and "Tests/".
...
I'm working with X12 EDI Files (Specifically 835s for those of you in Health Care), and I have a particular vendor who's using a non-HIPAA compliant version (3090, I think). The problem is that in a particular segment (PLB- again, for those who care) they're sending a code which is no longer supported by the HIPAA Standard. I need to l...
In a text, I would like to replace all occurrences of $word by [$word]($word) (to create a link in Markdown), but only if it is not already in a link. Example:
[$word homepage](http://w00tw00t.org)
should not become
[[$word]($word) homepage](http://w00tw00t.org).
Thus, I need to check whether $word is somewhere between [ and ] and on...
Hey guys,
I've got a regex issue, I'm trying to ignore just the number '41', I want 4, 1, 14 etc to all match.
I've got this [^\b41\b] which is effectively what I want but this also ignores all single iterations of the values 1 and 4.
As an example, this matches "41", but I want it to NOT match:
\b41\b
...