How would I check that NSRegularExpressionSearch exists before using it?
enum {
NSCaseInsensitiveSearch = 1,
NSLiteralSearch = 2,
NSBackwardsSearch = 4,
NSAnchoredSearch = 8,
NSNumericSearch = 64,
NSDiacriticInsensitiveSearch = 128,
NSWidthInsensitiveSearch = 256,
NSForcedOrderingSearch = 512,
NSRegularExpressionSearch...
Hello,
I'm using Yahoo! Weather RSS Feed in order to get the forecast for my town. I can parse the XML and get weather description, but then I get a result like this:
<img src="http://l.yimg.com/a/i/us/we/52/11.gif"/><br />
<b>Current Conditions:</b><br />
Light Rain, 18 C<BR />
<BR /><b>Forecast:</b><BR />
Tue - PM Thundershower...
How do I go from this:
"01","35004","AL","ACMAR",86.51557,33.584132,6055,0.001499
to this:
ACMAR, AL
...
I am attempting to split the ORDER BY statement of a SQL query into an array. First inclination is:
order_by.split(',')
but that does not work for order by statements like the following:
SUBSTRING('test',1,3) ASC, SUBSTRING('test2', 2,2 ) DESC
The desired output for the above statement would be:
["SUBSTRING('test',1,3) ASC", "SUB...
I want to use regular expression to grab the url from a html css link tag from the HTML source code
eg
<link rel="apple-touch-icon" href="http://sample.com/icons/apple-touch-icon.png">
any help??
...
How would you parse the values in a string, such as the one below?
12:40:11 8 5 87
The gap between numbers varies, and the first value is a time. The following regular expression does not separate the time component:
str.split("\\w.([:]).")
Any suggestions?
...
I need to replace all instances of a match but only within certain tags.
For example, consider an HTML page that has a <body>...</body>
within these tags I need to replace all occurance of say:
{embed=xxx}
to
<a href="xxx">xxx</a>
I can do this for the whole page using something like (attempt #1):
match={embed=(.*?)}
replace=<a...
I need a regex pattern that validates IP addresses. This is easy enough to google for, but I there is a small catch. I need the last numbers to be able to accept a range. So the following input would validate.
XXX.XXX.XXX.X-Y
so something like 168.68.2.1-34
I have found patterns for normal IP addresses, but none for handling ranges.
...
I'm a newbie to ruby, I want to know if I can use just one line to do the job.
Take the 'search' of this site for example. When user typed [ruby] regex, I can use following code to get the tag and keyword
'[ruby] regex' =~ /\[(.*?)\](.*)/
tag, keyword = $1, $2
Can we write it just in one line?
UPDATE
Thank you so much! May I make...
I want to filter out duplicate customer names from a database.A single customer may have more that one entry to the system with the same name but with little difference in spelling. So here is an example: A customer named Brook may have three entries to the system
with this variations:
Brook Berta
Bruck Berta
Biruk Berta
let's assum...
input: name <[email protected]>; hans@dhdfhgdfgh <hans.dampf@xxxx>;
Output: [email protected], [email protected], [email protected],[email protected]
So basically I have to erase the stuff between: >;(?*)< But my regex isn't working. can anyone help me?
Simon
...
Hi all,
I have a range of files of a specific format. I have pasted an example here.
----------------------------------------------
Attempting to factor n = 160000000000110400000000018963... Found a factor: 400000000000129
Time (s): 18.9561
----------------------------------------------
Attempting to factor n = 164025000000137700000000...
hi,
i have a notes column which contains text and has an id within the text, something like
"some random text (actvityid - 1234)"
i need to pull out the id 1234 in this case and update the activityid column within the same table.
my query looks like this
"UPDATE table_name SET activityId = {$f['activityId']} WHERE notes REGEXP '{$f['...
Hi,
I need a regular expression to check a field is either empty or is exactly 13 digits?
Regards,
Francis P.
...
I have the following regex in a C# program, and have difficulties understanding it:
(?<=#)[^#]+(?=#)
I'll break it down to what I think I understood:
(?<=#) a group, matching a hash. what's `?<=`?
[^#]+ one or more non-hashes (used to achieve non-greediness)
(?=#) another group, matching a hash. what's the `?=`?
So the p...
I have a string in the format:
MyList.Where(abc).GroupBy(def).Sum(ghi)
The Where & GroupBy parts are optional as is the argument to the function, so.
ThisList.Count
is also valid.
I'm trying to find a RegEx string that will match this and return the values:
The List name (e.g. MyList), the where condition (e.g. abc), the GroupBy a...
I have found a Regex that test if the text passed to a TextBox is an email.
If Regex.IsMatch(email.Text, "^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))" + "(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$") _
Then
// True
End If
I want to change thi...
i've created a function to get plain text from HTML by striping out
JavaScript , CSS , HTML tags etc. for that i've relied upon PHP's preg_replace
function to remove certain patterns. The webpages are already stored on hard disk so i'm taking source code from disk. The function is working properly for source code from single files howev...
How can I make a regex pattern for use with the PHP preg_replace function that removes all characters which do not fit in a certain pattern. For example:
[a-zA-Z0-9]
...
An example:
<p> Hello</p>
<div>hgello</div>
<pre>
code
code
<pre>
turns in something like:
<p> Hello</p><div>hgello</div><pre>
code
code
<pre>
How to do this in python? I make also intensive use of < pre> tags so substituting all '\n' with '' is not an option.
What's the best way to do that?
...