I am implementing small url handler that will need to match the following (assuming each one would be a separate regex).
http://mysite.com/products/could/be/this/long.aspx
http://mysite.com/search.aspx OR /search/keyword1+keyword2.aspx (only need to know that search is in the first part)
http://mysite.com/somename/products/could/be/this...
Does anyone know of a good set of tutorials for regular expressions? Particularly in a Textmate context? I am familiar with regular expression syntax, and the basic concepts. Even own a copy of Jeffrey Friedl's book "Mastering Regular Expressions" and read though the Perl parts.
What I am looking for are some high quality demonstration...
Hi
I am in a situation where I need to match two strings containing HTML.I I can not use exact comparison as the two stings may differ sometimes due to white spaces or something like etc.
I tried using replace( /[\r\n\t]/g, '' ) this solved my problem with the white spaces.But
I am not sure , how can I compare string to succes lik...
I'm trying to match substrings that are enclosed in %'s but preg_match_all seems to include several at the same time in the same line.
Code looks like this:
preg_match_all("/%.*%/", "%hey%_thereyou're_a%rockstar%\nyo%there%", $matches);
print_r($matches);
Which produces the following output.
Array
(
[0] => Array
(
...
$match_expression = '/<a href="look.php\?id=(.*)" title="Look page: (.*)">(.*)<\/A>/';
$radompgr = preg_match_all($match_expression,$q2,$match, PREG_SET_ORDER);
if($radompgr == TRUE){echo "found $radompgr<br>";}else{echo "not found $radompgr<br>";} //found
for ($i = 0; $i < count($match); $i++) {
$mathcas = $match[$i][1];
$rado...
I ran into a weird behavior from Oracle this morning... And I can't understand why it acts this way from the docs. I'm sorry for the long post, but I want to make sure I'm understood.
Oh, and make sure to read the note at the end before answering :)
The goal of the request is to return rows with 1 or more lowercase characters. For the s...
I have the following regular expression in .Net
(?<=Visitors.{0,100}?"value">)[0-9,]+(?=)
and the following text
<div class="text">Visitors</div> <div class="value">14,000,000</div>
<div class="text">VisitorsFromItaly</div> <div class="value">15,200</div>
I specify in the regex either "Visitors" or "VisitorsFromItaly" and I get the...
I'm hoping someone can see the problem in the following Regex replace example done using Flex:
remainder=inputString.replace(
"\\("+bracketContents+"\\)(\\s)*(and|or)*(\\s|$)+",
"");
For the following example:
Input: "a and (e or f)"
the normal regex expression given above would be:
\(e or f\)(\s)*(and|or)*((\s)+|$)+
...
I need help with regular expressions. What I'm looking for is a regex that looks for link-tags like this:
<link rel="stylesheet" href="style.css" type="text/css">
Irrespective of where href="" is positioned, I would like to look it up in the link-tag and put a variable named $url in front of style.css with a / following. If it finds ...
I keep getting an error for this regular expression:
^((([1-9])|(1[0-2])):([0-5])(0|5)/s(A|P)M)$
It's supposed to be for a time that ends in 0 or 5. So here are some that should work:
1:25 PM
11:00 AM
9:55 PM
But I keep getting this error message:
Internal error matching pattern '^((([1-9])|(1[0-2])):([0-5])(0|5)/s(A|P)M)$' ag...
I have a string that looks like this:
'p10005c4'
I need to extract the productId 10005 and the colorId 4 from that string into these variables:
$productId
$colorId
productId is > 10000.
colorId > 1.
How can I do this clean and nice using regex?
...
I'm looking for a way to get all the form inputs and respective values from a page given a specific URL and form name.
function GetForm($url, $name)
{
return array
(
'field_name_1' => 'value_1',
'field_name_2' => 'value_2',
'select_field_name' => array('option_1', 'option_2', 'option_3'),
);
}
GetForm('http:/...
I have a string that kind of looks like this:
"stuff . // : /// more-stuff .. .. ...$%$% stuff -> DD"
and I want to strip off all punctuation, make everything uppercase and collapse all whitespace so that it looks like this:
"STUFF MORE STUFF STUFF DD"
Is this possible with one regex or do I need to combine more than two? This i...
Here's the Pipe though you may not need it to answer the question: http://pipes.yahoo.com/pipes/pipe.info?%5Fid=85a288a1517e615b765df9603fd604bd
I am trying to modify all url's as so:
http://mediadownloads.mlb.com/mlbam/2009/08/12/mlbf_6073553_th_3.jpg with
http://mediadownloads.mlb.com/mlbam/2009/08/12/mlbtv_6073553_1m.mp4
The synta...
I'm using the wonderful RegexKitLite framework built upon the ICU library that ships with Mac OS X and iPhone OS. It has been smooth sailing so far, with the exception of this error that appears intermittently when searching for matches:
Internal Error
Invalid parameter not satisfying:
(cacheSlot->setToHash == buffer->hash) && (cacheSlo...
I am using RegexKitLite in an iPhone project and want to use regex to find words that start with the @-sign. For instance, "@home @chores", when searched, would return both words.
The regex string I am using is "(?m-s:@.*\\s*)". When I use this, though, I get a crash. When I use the same thing, but with a # instead of @, it works just f...
Need Some Help With Regex:
I want to replace
[url=http://youtube.com]YouTube.com[/url]
with
<a href="http://youtube.com">YouTube.com</a>
the regex
preg_replace("/[url=(.*?)](.*?)[/url]/is", '<a href="$1">$2</a>', $text);
why does this give me:
Warning: preg_replace() [function.preg-replace]: Unknown modifier 'r' in C...
Is there any way to replace a regexp with modified content of capture group?
Example:
Pattern regex = Pattern.compile("(\\d{1,2})");
Matcher regexMatcher = regex.matcher(text);
resultString = regexMatcher.replaceAll("$1"); // *3 ??
And I'd like to replace all occurrence with $1 multiplied by 3.
edit:
Looks like, something's wrong :...
I have text file:
gvim file.txt
In UNIX you can type this at any command prompt. If you are running Microsoft
Windows, open an MS-DOS prompt window and enter the command.
In either case, Vim starts editing a file called file.txt. Because this
is a new file, you get a blank window. This is what your screen will look
like:
...
Hi,
I need to retrieve content of <p> tag with given class. Class could be simplecomment or comment ...
So I wrote the following code
preg_match("|(<p class=\"(simple)?comment(.*)?\">)(.*)<\/p>|ism", $fcon, $desc);
Unfortunately, it returns nothing. However if I remove tag-ending part (<\/p>) it works somehow, returing the string wh...