Have a IIS7 URL rewrite rule which uses friendly url so for example regEx is ([A-Za-z]+)/([A-Za-z]+)
www.mysite.com/genetics/overview
gets rewritten to
www.mysite.com/genetics/default.aspx?a=overview
Now I need to change the RegEx so it excludes the Content folder and any subdirectory in this folder. Been trying a few examples with ...
Hi
$str = 'some text <MY_TAG> tag <em>contents </em> </MY_TAG> more text ';
My questions are:
How to retrieve content tag <em>contents </em> which is between <MY_TAG> .. </MY_TAG>?
And
How to remove <MY_TAG> and its contents from $str?
I am using PHP.
Thank you.
...
I have the following regular expression:
^[-+]?[\d{0,3},?\d{3}]*\.?\d+$
I am trying to support numbers of the following formats:
1
-1
-1.00
100,000
I am not concerned about scientific notation but my users may or may not enter in commas. The problem I am having is that the expression is matching:
100,
100,00
How can I have t...
I'm looking for a way to find/replace links to images (within user-generated content) without touching links to non-images.
For example, the following text:
<a href="http://domain.com/arbitrary-file.jpg">Text</a>
<a href="http://domain.com/arbitrary-file.jpeg">Text</a>
<a href="http://domain.com/arbitrary-path/arbitra...
I have two string variables which are both file paths. The code that worked used ereg which is deprecated, so I'm trying to rewrite it using preg_match:
Old code that worked:
$path1 = quotemeta($path);
ereg("$path1(.*)$", $path2, $matches);
Using preg_match which doesn't seem to work:
$path1 = quotemeta($path);
preg_match("/$path1(....
Hello,
I have a sentence structure along the lines of
[word1]{word2} is going to the [word3]{word4}
I'm trying to use a javascript regex to match the words for replacement later. To do this, I'm working towards getting the following multi-dimensional array:
[["word1", "word2"],["word3","word4"]]
I'm currently using this regex for ...
Is there a way to gather all links that has a specific domain in a string where they only include ones that are either:
href="http://yahoo.com/media/news.html"
or
>http://yahoo.com/media/news.html<
So basically links either prefixed by href=" and ends with "
or
links that are surrounded by ><.
I tried to use Regex ( "href=\"(...
Can someone explain this to me.
I am pretty good with perl regular expressions but evidently I am at a loss on why this doesn't work.
The code below stores "Person Test" in output variable.
im output As String
Dim userName As String = "Test, Person"
Dim re As New Regex("(\w+),\s(\w+)", RegexOptions.Singleline)
output = re.Replace(userN...
Hi there I was wondering whether someone know how to remove both the url and the link text from all anchor tags in a big paragraph of text. once remove if I could store them in an array for later use.
Im sure this is possible but I really struggle with regex.
Hopefully there is someone out there who has came across this before or who ...
I have a huge string that looks like this:
"Text
Text
Text
Text
Text
Text
Text
Text
Text
Text
Text
Text
"
Note that in between each text block is a new line. Also note that the very final text block has TWO new lines after it. So when I do a
string[] strArray = Regex.Split(content, "\r\n");
This works well, since it looks for a...
How do I use lookahead assertion to determine if a certain character exist at most a certain number of times in a string.
For example, let's say I want to check a string that has at least one character to make sure that it contains "@" at most 2 times. Thanks in advance. Using python if that matters.
...
I want to capture text in an attribute within an XML tag. That is
<tag1 name="tag^*&,+">
I want to capture the value within the name attribute (which in this case would be tag^*&,+). This regular expression
name=\"([a-z0-9]+)\"
will only return the value if the text in the attribute is alphanumeric. Is there any syntax that will...
I have a file containing a list of file names:
esocket.c
esocket.h
dockwin.cpp
dockwin.h
makefile
getblob
.
etc...
I am looking for a regular expression (preferably unix syntax) to do the following:
get lines that have .c, cpp and .h files
get lines that don't have a file extension.
...
Hello
I am very naive with regular expressions and I wasn't really able to find what I need.
For website validation purposes, I need first name and last name validation.
For first name it should only contain letters and can be several words with space and no letters and as minimum 3 characters and at top 30 characters. Empty string sho...
Is there a way to get single regex to satisfy this condition??
I am looking for a "word" that has three letters from the set MBIPI, any order,
but MUST contain an I.
ie.
re.match("[MBDPI]{3}", foo) and "I" in foo
So this is the correct result (in python using the re module), but can I get this from a single regex?
>>> for foo in (...
I have to use a crippled tool which doesn't provide any way to trim leading an trailing spaces from a string. It does have .NET style regex, but only Match is implemented, not replace. So, I came up (surprisingly by myself) with this regex that seems to work.. but I don't completely understand why it works :-)
$trimmed = regex/[^ ].*[^ ...
Hi, is there a really easy way to grab the text of a rel attribute i.e
<a href='#' rel='i want this text here'></a>.
I have tried this morning with regex but am having no luck.
...
I have heard that MSBuild 4.0 has increased Regex parsing support. However, I am unable to find any detailed documentation/links/material on this. Can anyone give a brief description of the new features and/or possibly give pointers to more material?
Thanks in advance.
...
I'm writing a CMS in ASP.NET/C#, and I need to process things like that, every page request:
<html>
<head>
<title>[Title]</title>
</head>
<body>
<form action="[Action]" method="get">
[TextBox Name="Email", Background=Red]
[Button Type="Submit"]
</form>
</body>
</html>
and replace the [...] of course.
My qu...
Hi,
I'm completely new to regular expressions, and I need to filter all the words of at least 3 characters (and a maximum size of 16) out of a text. (so I can enter those data into a MySQL database)
Currently, everything works, except for the regular expression:
/^.{3,16}$/
(I constructed this from a tutorial found using Google ;-) ...