Hi,
I am trying to filter out some text based on regex like phone* means i want the text "Phone booth", "phone cube" etc.
But when I give booth* it selects Phone booth also. It should not select it rite? Here is the code,
string[] names = { "phone booth", "hall way", "parking lot", "front door", "hotel lobby" };
string input ...
The Function:
function doSomething($url){
$url = "<a href=\"{$url}\" target=\"blank\" title=\"{$url}\">{$url}</a>";
return $url;
}
The replacement
$content = preg_replace("#(http:\/\/+[^\s]+)#ie","doSomething('$1')", $content);
The Problem:
Fatal error: Cannot redeclare
doSomething() (previously declared
in
http:/...
This isn't working for some reason it just crashes my app:
NSString *urlRegex = @"\\bhttps?://[a-zA-Z0-9\\-.]+(?:(?:/[a-zA-Z0-9\\-._?,'+\\&%$=~*!():@\\\\]*)+)?";
NSString *urlParsedStatus = [status stringByReplacingOccurrencesOfRegex:urlRegex withString:@"<a href=\"$1\">$1</a>"];
NSLog(@"new string: %@", urlParsedStatus);
any idea...
Rewritten my url. However I can still access rewritten urls with question marks and plus signs.
lovelakedistrict.com/lake-district-cottages/?cottages=2/
lovelakedistrict.com/lake-district-cottages/?cottages/2/
lovelakedistrict.com/lake-district-cottages/cottages/2/
The three urls above are the exact same page, I would like to properly...
I have this text input, and I need to check if the string is a valid web address, like http://www.example.com. How can be done with regular expressions in PHP?
...
so, my URL is example.com/?ref=person
but ref is null after the regex. What am I doing wrong here?
function getReferer(){
var regex = new RegExp(/ref=(.+)/);
var ref = regex.exec(window.location.ref);
alert(ref);
if (ref == null) return "";
else return ref[1];
}
...
I need to extract IP address in the form
prosseek.amer.corp.com [10.0.40.147]
or
prosseek.amer.corp.com (10.0.40.147)
with Python. How can I get the IP for either case with Python? I started with something like
site = "prosseek.amer.corp.com"
m = re.search("%s.*[\(\[](\d+\.\d+\.\d+\.\d+)" % site, r)
but it doesn't work.
ADDE...
I have he following scenario:
Got an HTML template file that will be used for mailing. Here is a reduced example:
<table>
<tr>
<td>Heading 1</td>
<td>heading 2</td>
</tr>
<PRODUCT_LIST>
<tr>
<td>Value 1</td>
<td>Value 2</td>
</tr>
</PRODUCT_LIST>
</table>
All I need to do is to get the HTML code inside <PRODUCT_LIST> and then rep...
I have ref=Apple
and my current regex is
var regex = /ref=(.+)/;
var ref = regex.exec(window.location.href);
alert(ref[0]);
but that includes the ref=
now, I also want to stop capturing characters if a & is at the end of the ref param. cause ref may not always be the last param in the url.
...
So I've got the following HTML code:
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="quality" value="high" /><param name="movie" value="/uploads/flash/test1.flv" /><embed pluginspage="http://www.macromedia.com/...
This question is nearly identicle to : http://stackoverflow.com/questions/2305362/php-search-string-with-wildcards, but will be arranged a little differently. I had a hard time understanding the proposed solutions to make my own out of them . Maybe you guys can help?
I have a start string and an end string which I use to sandwich string...
How would I go about extracting text between 2 html tags using delphi?
Here is an example string.
blah blah blah<tag>text I want to keep</tag>blah blah blah
and I want to extract this part of it.
<tag>text I want to keep</tag>
(basically removing all the blah blah blah garbage that comes before and after the <tag> & </tag> strings ...
Despite attempts to master grep and related GNU software, I haven't come close to mastering regular expressions. I do like them, but I find them a bit of an eyesore all the same.
I suppose this question isn't difficult for some, but I've spent hours trying to figure out how to search through my favorite book for words greater than a cer...
Possible Duplicate:
RegEx match open tags except XHTML self-contained tags
I have the following string:
$str = "
<li>r</li>
<li>a</li>
<li>n</li>
<li>d</li>
...
<li>om</li>
";
How do I get the HTML for the first n-th <li> tags?
Ex : n = 3 ; result = "<li>r<...>n</li>;
I would like a regexp if possible.
...
SQL Server 2008 R2 has a new Master Data Services feature that includes some really nice regular expression matching & extraction functions:
http://msdn.microsoft.com/en-us/library/ee633712.aspx
I am running 2008 R2, and want to run those functions outside of the MDS database.
How can I? Is there a way to extract them and reapply the...
Hello,
I want to parse a string of 12 (often) different floats in a row (with some irrelevant text in front, marking a field), and want them all to end up in a capturing group of their own, so as to collect them from the matcher one at a time. I've noticed I am succeeding by writing the following:
Pattern lastYearIncomePattern = Patter...
Why do you have to make your regex "very magic" so that you don't have to escape your capture quotes? And if you set your environment to very magic, you are non-standard and may have compliance issues. I am just wondering why vim uses a different regex syntax than say, perl?
...
Dudes, do you have it?
...
I'm displaying currency using the current method
String.Format("{0:C}", item.DonationAmount)
Which outputs like $10.00
We will be dealing with large dollar amounts, and no cents. We would like the currency to display as $10 without the decimal or zeroes. How can I do this? Removing the currency format makes the number display like 10...
I have a two part problem that needs fixing. I'll try my best to describe it then break down what I "think" the steps are.
I am trying to get a specific table in a webpage and email it to myself.
At the moment what I am trying is to use GNU\Win32 wget.exe (I'd rather use PowerShell natively but for some reason I couldn't, perhaps becau...