|
How do i match each of the following with regex ?
some text includes [any number of character]. need to pull the entire [asdfasdf]
@tableid='sometext' I need to pull the sometext
mary and drugs I need to pull " and ", spaces included.
Started by g2g23g on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Try these:
"\[(.*?)\]" "@\w+='(.*?)'" " +and +"
irb(main):002:0> "some text include [abcdef]".match(/\[(.*)\]/)[1] => "abcdef" irb(main):005:0> "@table_id='2356'".match(/'(.*)'/)[1] => "2356" irb(main):006:0> "mary and drugs".match(/mary... .
|
|
Hi,
I was creating a regex for following condition
a string can contain any alphabet, digit and ' and ? the string should start with either alphabet or digit
for ex:
adsfj asfj's jfkd'sdf? df ds? afjdk?
are all valid
I use C# 2.0
I tried something like...
Started by Amit on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
To specify a minimum and maximum lengths, change the regex to:
^[a-zA-Z0-9][a-zA-Z0-9?']{minlen-1....
How about:
Regex rx = new Regex(@"^[a-z\d][a-z\d'?]*$", RegexOptions.IgnoreCase);
This would match even allow strings of length one.
|
|
I'm looking for a Perl regex that will capitalize any character which is preceded by whitespace (or the first char in the string).
I'm pretty sure there is a simple way to do this, but I don't have my Perl book handy and I don't do this often enough that...
Started by Kip on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
Have you thought about capitalization inside not implemented in regex....
As noted complicated than you think and a simple regex might not work.
For this regex; it turns off the 'case-setting' switch \U in this case or \L for lower-case.
|
Ask your Facebook Friends
|
I have the following patterns in a URL.
John.Smith John.Smith.1 John.Al-Smith John.al-smith.1 John.Smith.Al-Caboon Where the first (.) is mandatory and with at least one character before and after the first (.), the rest of the stuff (the numbers, hyphen...
Started by Galilyou on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
You should.
It matches "anything".
"." is a meta character in regex.
Problems observed with your regex
1.
|
|
Hello all,
I have strings like that
OPEN SYSTEMS SUB GR (GM/BTIB(1111)/BTITDBL(2222)/BTVY(4444)/ACSVTYSAG)
and I need to extract 2222 from it.
What I was doing is this on the GROUPS String:
SUBSTRING(GROUPS, CHARINDEX('(',GROUPS, CHARINDEX('(',GROUPS,...
Started by stckvrflw on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Okay I understand now what you need everyting starting....
See this article for a nice explanation.
You can, however, use CLR integration to add a .NET stored procedure which can use regular expressions .
SQL Server does not natively support regular expressions.
|
|
Hi, I have user defined string (html formated string to be saved and used in web) and need to find a way to replace each white space which is right after a single letter by .
For example "this is a string" should become "this is a string" ...
Started by WebXpert on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Without regex
$str = "this is a string" ; $s.
Nbsp;', '$1 '), $str); ?>
Should do the trick.
|
|
I guess my question is best explained with an (simplified) example.
Given the case there's one regex like
^\d+_[a-z]+$
and another regex like
^\d*$
it's clear that something regex 1 matches to, will never match regex 2. So regex 2 is orthogonal to regex...
Started by bene on
, 11 posts
by 10 people.
Answer Snippets (Read the full thread at stackoverflow):
I would do the following:
convert each regex to a FSA, using something likeYou can maybe use something like Regexp::Genex to generate test strings to match a specified regex and then use the test string on....
That a solution exists.
|
|
<p>This will serve as a debug page.</p> <p><img src="http://mattmueller.me/blog/wp-content/uploads/2009/12/threadless.png" alt="Threadless" title="Threadless" width="650" height="150" class="alignnone size-full wp-image-73" />&...
Started by Matt on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
S/<p>(<img.*?\/>)<\/p>/$1/g
$x = preg_replace('/<p[^>]*>(<img[^>]*>)<\/p[^>]*>/', '$1', $x);
Where $x is your content
Here's a great tool that will help you, hopefully:
http://www.gskinner.com/RegExr/ .
|
|
I am looking for a function that would be able to do the same thing as the MySQL REGEX function for TSQL. Basically i need my Query to look something like the following:
SELECT * FROM Routing WHERE (@Message REGEX RouteRegex);
I am not to keen to use ...
Started by Neale on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Go for CLR but the function below also works great toast, but you can use the ....
LFSR is right about the CLR.
Http://www.sqlteam.com/article/regular-expressions-in-t-sql
It communicates with the Regex library with Regex via the CLR .
|
|
Hello,
I am writing a regex to use with the GNU C regex library:
The string is of the form: (text in italics is a description of content)
(NOT a #) start (maybe whitespace) : data
I have written the following code, but it won't match.
regcomp(&start_state...
Started by gogodidi on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
}, }; int i; regex_t start_state; const char *pattern = "^[ \\t]*(state)[ \\t]*:.*$"; if (regcomp.
|