I'm stressing out trying to create a url rewriter.net rule for my web site.
I have a link
http://localhost/Pages/CategoryList.aspx?ID=2&Page=1
And I want replace it by this
http://localhost/Category/2.aspx?Page=1
I tried the following:
<rewrite url="~/Category/(.+).aspx?Page=(.+)" to="~/Pages/CategoryList.aspx?ID=$1&Pa...
I'm after a regex ( php / perl compatible ) to get the first sentence out of some text. I realize this could get huge if covering every case, but just after something that will be "good enough" at the moment. Anyone got something off the shelf for this?
...
I'm trying to do remove javascript comments via regex in C# and have become stuck. I want to remove any occurrences of double slash // style comments.
My current regex is (?<!:)//[^\r\n]* which will catch all comments and prevent matching of http://. However, the negative lookbehind was lazy and of course bit me back in the following ...
I have a string of characters and want to isolate 2 characters.
Isolate a or b from string:
"a48y jvu5agbl=dbz'bk;ahc"
Should get something like this:
aabbba
This regex gets me the correct result and whatever's left. How do I chop off the end?
str.replace(/.*?(b|a)/g,"$1");
Thanks. Any other way to isolate the characters is great...
Hi,
If i have these strings:
banana not included. apple included.
banana, apple included.
the regex below returns a match on both strings but I don't want a match on the first string
banana.*(?<!(\bnot ))inc(\.|luded)?
What am I missing in my regex to achieve my desired result.
Thanks!
...
How do I parse HTML using regular expressions in C#?
For example, given HTML code
<s2> t1 </s2> <img src='1.gif' /> <span> span1 <span/>
I am trying to obtain
1. <s2>
2. t1
3. </s2>
4. <img src='1.gif' />
5. <span>
6. span1
7. <span/>
How do I do this using regular expressions in C#?
In my case, the HTML input is not well-for...
I want to change this:
_(with(new FuListNode )->isList())->shouldBe(true);
_(with(new FuListNodes)->isList())->shouldBe(false);
_(with(new FuTreeNode )->isList())->shouldBe(true);
_(with(new FuTreeNodes)->isList())->shouldBe(false); } }
to this (look at the booleans at the end):
_(with(new FuListNode )->isList())->shouldBe(false);
_(...
How would you split Regex subexpression matches in to multi-dimensional string arrays?
I have a "myvar" string of:
1-4:2;5-9:1.89;10-24:1.79;25-99:1.69;100-149:1.59;150-199:1.49;200-249:1.39;250+:1.29
which is a repeat of QuantityLow - QuantityHigh : PriceEach ;
I used this "myreg" Regex /(\d+)[-+](\d*):(\d+\.?\d*);?/g
Used it with ...
Currently I have three URL paths that map to ServiceHandler. How do I combine the three into one neat regex that can pass n number of arguments to ServiceHandler?
(r'/s/([^/]*)', ServiceHandler),
(r'/s/([^/]*)/([^/]*)', ServiceHandler),
(r'/s/([^/]*)/([^/]*)/([^/]*)', ServiceHandler)
...
How can I validate linear equations with regular expressions or is there another way besides using regular expressions. I will use ^ to denote an exponent.
2x + 3 = 8 //This should validate fine
3x + 2y + 4z = 12 //This should validate fine
4x^2 + 2y = 22 //This should not validate because of the power.
4xy + 3y = 45 //This should n...
May I know what ?= means in a regular expression? For example, what is its significance in this expression:
(?=.*\d).
...
Hello!
I can't solve my problem with regexp.
Ok, when i type:
$string = preg_replace("#\[name=([a-zA-Z0-9 .-]+)*]#","$name_start $1 $name_end",$string);
everything is ok, except situation with Russian language.
so, i try to re-type this reg-exp:
$string = preg_replace("#\[name=([a-zA-Z0-9**а-яА-Я** .-]+)*]#","$name_start $1 $name_e...
Hi all,
I'm trying to match attributes from a html tag, but I can't get it working :)
Let's take this tag for example:
<a href="ddd" class='sw ' w'>
Obviously the last part is not quite right.
Now I tried to match the attributes part with this piece of code:
preg_match('/(\s+\w+=(?P<quote>(\'|\"))[^(?P=quote)]*(?P=quote))*/U', " ...
Hi I am looking into writing a regular expression that will match the following
/book/The-title-of-the-book/0000000000/
where The-title-of-the-book is any alphanumeric character and a '-', 0000000000000 is the 10 or 13 digit isbn of the book, e.g. /book/To-kill-a-mockingbird/0099419785/.
can you suggest what pattern I may use to cons...
Hello World,
I need custom Markdown library for PHP which converts new lines to <br/> without the need to put double space on the end of the line, kinda like here on SO. I've been looking on the web but without success. I know I could just amend standard library but my regex skills are none.
Does anybody know about such library in exi...
A quick question for a change.
Perl:
$string =~ s/[áàâã]/a/gi; #This line always prepends an "a"
$string =~ s/[éèêë]/e/gi;
$string =~ s/[úùûü]/u/gi;
This Regex should convert "été" into "ete". What it does instead is converting it to "aetae". In other words, it prepends an "a" to every matched element. Even "à" is converted to "aa".
...
I want to validate a text box that doesn't accept any special characters using regular expressions. It just takes letters and numbers from 0 to 9. Please provide me the correct regex.
...
I've constructed a form, but some rows of the form can potentially be returned blank, with default values. I'm trying to find a way of searching the form output and then deleting the bit which I know is not needed - which looks like:
<tr bgcolor="#FFFFFF">
<td>2E</td>
<td id="8003">-800</td>
</tr>
I've used str_replace() effectively o...
Hello!
I write some easy parser for my page and have some problem with it.
HTML text:
<p>some text</p><p>another text</p>
If I try use something like:
preg_split("#<p>#",$string);
I have a result without <p>, and this is very very bad. (only </p> exist)
Maybe I can split this string to array, but don't remove </p>?
...
I have a datagrid and a search field. I've set the change event of the search field to run the filterfunction of the datagrid. I'm able to match the entire term, but I'd like to be able to use a regular expression to do a progressive search (e.g., "Pe" matches "Peter"). I tried to create a regular expression to compare the fields, but I ...