I'm just trying to figure out the regex to find any ampersands that aren't immediately preceded and followed by a space. For example, it would find "asdf&asdf" and "asdf& asdf" but not "asdf & asdf"
This will be used in a preg_replace to add spaces before and after. (If you're wondering, the problem is that I'm stuck with a WYSIWYG that...
Hi There,
So i'm looking to scrape rapidshare.com links from websites. I have the following regular expressions to find links:
<a href=\"(http://rapidshare.com/files/(\\d+)/(.+)\\.(\\w{3,4}))\"
http://rapidshare.com/files/(\\d+)/(.+)\\.(\\w{3,4})
How can I write a regex that will exclude text that is embedded in a <a href="..."> tag...
I have the following information in a config file:
Begin
0
0
13
44
59
047
8784
I'm reading that information and a ton of other information from the config file in as l.
My regex is:
string points = points = Regex.Match(l, @"BEGIN\r\n(\d+)$").Groups[1].Value;
it's returning ""
Where am I going wrong with this Reg...
I need to parse a string so the result should output like that:
"abc,def,ghi,klm,nop"
But the string I am receiving could looks more like that:
",,,abc,,def,ghi,,,,,,,,,klm,,,nop"
The point is, I don't know in advance how many commas separates the words.
Is there a regex I could use in C# that could help me resolve this problem?
...
Hey guys!
I'm new to Regular Expressions...
I've been asked a regular expression that accepts Alphanumerics, a few characters more, and only ONE whitespace between words.
For example :
This should match :
"Hello world"
This shouldn't :
"Hello world"
Any ideas?
This was my expression:
[\w':''.'')''(''\[''\]''{''}''-''_']+$
...
I have some difficulties in understanding if-then-else conditionals in regular expressions.
After reading If-Then-Else Conditionals in Regular Expressions I decided to write a simple test. I use C++, Boost 1.38 Regex and MS VC 8.0.
I have written this program:
#include <iostream>
#include <string>
#include <boost/regex.hpp>
int ma...
Here's my regex problem: How can I select all results with a certain ID, e.g. "...ID=99" but excluding the results countinuing with an additional number like ID="990" or "ID=9923".
However if the string countinues with another non-number character ("&"), e.g. "...ID=99&PARAM=9290" it also should be included.
I am totally confused turni...
I need a regular expression pattern to check a string for alphanumeric(a-zA-z0-9) and also can contain underscore, hypen and dot
this will be a file name so i dont want other character than this.
...
Having the following regular expression:
([a-z])([0-9])\1
It matches a5a, is there any way for it to also match a5b, a5c, a5d and so on?
EDIT: Okay, I understand that I could just use ([a-z])([0-9])([a-z]) but I've a very long and complicated regular expression (matching sub-sub-sub-...-domains or matching an IPv4 address) that wou...
I want to return output "match" if the pattern "regular" is a sub-string of variable st. Is this possible?
int main()
{
string st = "some regular expressions are Regxyzr";
boost::regex ex("[Rr]egular");
if (boost::regex_match(st, ex))
{
cout << "match" << endl;
}
else
{
cout << "not match" << endl;
}
}
...
I need a regular expression that matches UTF-8 letters and digits, the dash sign (-) but doesn't match underscores (_), I tried these silly attempts without success:
([\w-^_])+
([\w^_]-?)+
(\w[^_]-?)+
The \w is shorthand for [A-Za-z0-9_], but it also matches UTF-8 chars if I have the u modifier set.
Can anyone help me out with this ...
I feel lost with the Regex Unicode Properties presented by RegexBuddy, I cannot distinguish between any of the Number properties and the Math symbol property only seems to match + but not -, *, /, ^ for instance.
Is there any documentation / reference with examples on regular expressions Unicode properties?
...
Hi,
I have the following regular expression:
RegExp("http://www.amazon.com/([\\w-]+/)?(dp|gp/product)/(\\w+/)?(\\w{10})");
Written in javascript.
How can I get it to work with PHP's preg_match_all? What are the differences as far as regular expressions go?
...
I'm enhancing our video search page to highlight the search term(s) in the results. Because user can enter judas priest and a video has Judas Priest in it's text I have to use regular expressions to preserve the case of the original text.
My code works, but I have problems with special characters like š, č and ž, it seems that Preg_Repl...
I would like to validate a hostname using only regualr expression.
Host Names (or 'labels' in DNS jargon) were traditionally defined by RFC 952 and RFC 1123 and may be composed of the following valid characters.
List item
A to Z ; upper case characters
a to z ; lower case characters
0 to 9 ; numeric characters 0 to 9
- ; dash
...
Hi,
I have a property files that contains things like:
myhome=/home/username
lib=/home/libs
and I want to, for instance, get the home path (i.e. /home/username):
If I use cat + grep like
cat property | grep myhome
then I get: myhome=/home/username
so I could use sed to remove the 'home=', i.e. remove everything before (and inclu...
From my related question here at SO I've come up with the following PHP snippet:
$url = parse_url($url);
if (is_array($url))
{
$depth = 2;
$length = 50;
if (array_key_exists('host', $url))
{
$result = preg_replace('~^www[.]~i', '', $url['host']);
if (array_key_exists('path', $url))
{
...
Hi Guys ive tried to search for this answer all morning, but with no luck,
all i want to do is match [slideshow or [gallery with the included [ bracket..
code as follows.
$gallery = get_post_meta($post->ID, 'gallery', true);
if (preg_match("|^/[slideshow", $gallery)) {
echo "Slideshow was forund";
} else if (preg_match("|^/[ngga...
I would like to brake a long word in my Ruby on Rails string (something like <wbr> in HTML). Is it possible to tell Ruby "add character x in string y each z characters"?
...
I am trying to grab any digits in front of a known line number of a phone, if they exist (in Perl). There will be no dashes, only digits.
For example, say I know the line number will always be 8675309. 8675309 may or may not have leading digits, if it does I want to capture them. There is not really a limit on the number of leading di...