As the title says , i need to find 2 specific words in a sentence. But they can be in any order and any casing. How do i go about doing this using regex.
E.g. This is a very long sentence used as a test
From that sentence i need to extract the words test and long in any order i.e. test can be first or long can be first.
UPDATE:
What i...
I have written the following regular expression. It should match only filenames or folder names that don't end in .aspx.
ValidationExpression=".*[^(\.aspx)]$"
But it does not work. So, kings of RegEx land, please help. I would also like to invalidate extensions such as .Aspx, .aSPx etc. ( I quickly learned that there are some differen...
How do I write a regular expression to match the following
CONTEXT_84 =
or
CONTEXT_5 =
thanks
...
I am using a regular expression to convert plain text URL to clickable links.
@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.-]*(\?\S+)?)?)?)@
However, sometimes in the text, URL are enumerated one per line with a semi-colon at the end. The real URL does not contain any ";".
http://www.aaa.org/pressdetail.asp?PRESS_REL_ID=275;
http://www.aaa....
I'm working on a webpage that takes a URL as a parameter, and would like it to be easily indexed by search engines. One requirement is that each URL appears as a directory.
My script is in the format:
myscript?url=<a url>&page=1
I'd like redirects to look something like:
lookup/<a url>/page:1/
The URL is predictably giving me tro...
Hi,
I have the following piece of text from which I'd like to extract all the <td ????>???</td> tags
<tr id=row509>
<td id=serv509 align=center class='style1'>Z Deviazione Tecnico Home verso S24 [ NON USATO ]</td>
<td align=center class='style4'>23</td>
<td align=center class='style10'>22</td>
<td align=center class='st...
Edit: This question has considerably evolved since I first asked it. See below for two fast+compatible, but not completely fully featured implementations. If you know of more or better implementations, please mention them, there still isn't an ideal implementation here yet!
Where can I find reliably fast Regex implementation?
Does ...
I have some programmatically assembled huge regex, like this
(A)|(B)|(C)|...
Each sub-pattern is in its capturing group. When I get a match, how do I figure out which group matches without linearly testing each group(i) to see it returns a non-null string?
...
How can I match the three words in the following string with a Perl compatible regular expression?
word1#$word2#$word3
I don't know the actual words "word1, word2 and word3" in advance. I only know the separator, which is #$.
And I can't use the word boundary as I have a multibyte encoding. This means for instance that the string can ...
In JavaScript/JQuery I want to get all the text that is seen between some other text. For example, if the HTML document had:
<b class="blah">Blah: Some Text 1</b>
<div id="foo"><b class="blah">Blah: Some Text 2</b>
I'd like to get an array that has 'Some Text 1' and 'Some Text 2' since they are both in between '<b class="blah">Blah: ...
I have a text file Qfile.txt and the contents are follows, and want to create another file with the same informations and but answers are diffrent. Qfile1.txt,Qfile2.txt
Qfile.txt
Question "What is your age?"
Answer ""
Question "What you doing?"
Answer ""
Question "What is you name?"
Answer ""
Qfile1.txt
Question "What is your age...
I would like to replace the | with OR only in unquoted terms, eg:
"this | that" | "the | other" -> "this | that" OR "the | other"
Yes, I could split on space or quote, get an array and iterate through it, and reconstruct the string, but that seems ... inelegant. So perhaps there's a regex way to do this by counting "s preceding | and...
Re: http://www.codinghorror.com/blog/archives/000633.html
Is there a plugin that turns VS2008's non-standard regex find/replace into a more standard version? I didn't find one when I googled for it, so my hopes are not high for this. I hate hate hate having to build a regex in my head and then have to think, "oh, I guess I need to refac...
I was reading an article put together by Martin Fowler regarding Composed Regular Expressions. This is where you might take code such as this:
const string pattern = @"^score\s+(\d+)\s+for\s+(\d+)\s+nights?\s+at\s+(.*)";
And break it out into something more like this:
protected override string GetPattern() {
const string patte...
I'd like to surround all words in a haystack starting with @ with <b> tags with javascript regex. What pattern would I use?
...
Related (but slightly different):
http://stackoverflow.com/questions/1216007/surrounding-all-instances-of-and-http-with-a
I would like to surround all instances of @_______, #________, and http://________ with anchor tags in one pass.
For example, consider this Twitter message:
The quick brown fox @Spreadthemovie jumps over t...
I need to match a single character that is anything but a space but I don't know how to do that with regex.
...
Hi all SO users!
I'm writing a CMS in PHP, and now I'm working at the themes feature. I have a .htaccess file:
RewriteEngine ON
RewriteRule ^([a-zA-Z][a-zA-Z0-9]*)$ index.php?m=$1
RewriteRule ^([a-zA-Z][a-zA-Z0-9]*)/(.+)$ index.php?m=$1&p=$2
If I have a request to:
/page
it must load the view function of the class called page.
If...
Hello , Im trying to make the following thing :
1) using regex to match all strings that have the following pattern "@username" << done i got the pattern @([A-z09_-]){4,20}
2) to parse the text from rich text box and to color those patterns "@somethign" in a color
3) make them clickable & when clicked to insert the clicked string in...
Given the following text
/feeds/tag/remote-desktop 1320 17007 22449240
/feeds/tag/terminal-server 1328 15805 20989040
/foo/23211/test 1490 11341 16898090
Let's say we want to convert those numbers to their comma-fied forms, ...