I have this line in one of my scripts and its throwing a deprecated error.
eregi_replace( '\.([a-z]{3,4})$', "-{$width}x{$height}.\\1", $src );
Can someone show me how to turn this into preg_replace and tell me why and which bits of it need to change so I can learn for future changes? I have had a go myself but where this bit of code...
I have a txt file that looks something like this
-----------------------------------
RUNNING PROCESSES
-----------------------------------
ftpd
kswapd
init
etc..
---------------------------------
HOSTNAME
--------------------------------
mypc.local.com
With sed I want to just get one section of this file. So j...
When I write a regex with . in it, it doesn't match new lines.
preg_match('/.*+?/') ...
What do I need to write, to match all possible characters, and new lines too?
...
const string strRegex = @"^(http|https|ftp)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}"
"(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*[^\.\,\)\(\s]$";
Regex rgxUrl = new Regex(strRegex, RegexOptions.Compiled
|RegexOptions.IgnoreCase);
If my URL is http://89.212.232.65 then this regex for checking URL fails. How must I chan...
I would expect this line of JavaScript:
"foo bar baz".match(/^(\s*\w+)+$/)
to return something like:
["foo bar baz", "foo", " bar", " baz"]
but instead it returns only the last captured match:
["foo bar baz", " baz"]
Is there a way to get all the captured matches?
...
I wanna extract https://www.sth.com/yment/Paymentform.aspx from below string
<form id='paymentUTLfrm' action='https://www.sth.com/yment/Paymentform.aspx' method='post'>
How can I do it with Regex or somthing ?
...
I'm currently working on a scanner generator.
The generator already works fine. But when using character classes the algorithm gets very slow.
The scanner generator produces a scanner for UTF8 encoded files. The full range of characters (0x000000 to 0x10ffff) should be supported.
If I use large character sets, like the any operator '....
I'm helpless on regular expressions so please help me on this problem.
Basically I am downloading web pages and rss feeds and want to strip everything except plain words. No periods, commas, if, ands, and buts. Literally I have a list of the most common words used in English and I also want to strip those too but I think I know how to d...
Hi,
How can i get the strings that only contains domain.tld?
if (preg_match('^(?:[-A-Za-z0-9]+\.)+[A-Za-z]{2,6}$', $domain))
echo "domain.tld found!";
but for the regex ^(?:[-A-Za-z0-9]+\.)+[A-Za-z]{2,6}$, sub domains are also okay. But i just want to check "domain.tld". What regex should i use for it?
Thank you.
...
Hello,
I have some trouble with regex and php here:
<span style="color: blue">word1</span> word by word by word <span style="color: red">word</span>
I'm trying to get word1 out. Is the regex the best way though? Need to process around 70 sencences like this.
UPDATE
$one = '<span style="color: blue">word1</span> word by word by w...
>>> zznew
'...0002211 118 7.5 "Weeds" (2005) {The Love Circle Overlap (#4.10)}'
>>> re.split('\(+\d+\)',zznew)
['...0002211 118 7.5 "Weeds" ', ' {The Love Circle Overlap (#4.10)}']
>>> m = re.match('\(+\d+\)',zznew)
>>> m.groups()
Traceback (most recent call last):
File "<pyshell#104>", line 1, in <module>
m.groups()
AttributeEr...
One of these days I'll get good at regex but for now...
I'm parsing an HTML page looking for MP3 files using the following expression (which works):
"<A HREF=\"([^\"]+)\"[^>]*>([^<]+?)\\.mp3</A>"
I now want to search for both MP3 and OGG files. Seems like a simple OR modification (.mp3 || .ogg), but I'm not quite sure how I put that ...
Hi.
In .NET, \p{L} matches any ascii or non-ascii letter (so it will match both a and ü).
http://www.regular-expressions.info/unicode.html#prop
Is there a Vim equivalent for this?
In Vim \a or \w will only match characters in range [a-z] (or [0-9A-Za-z_]).
...
I am having a strange problem with preg_match. I am using a regular expression that grabs the title of an article, basically looks for the tag:
preg_match('#(\<title.*?\>)(\n*\r*.+\n*\r*)(\<\/title.*?\>)#', $data, $matches)
When I print out the $matches array I get nothing. But when I try the same thing in a regular expression tester...
In my .htaccess file I have the following rule:
RewriteRule ^gallery/[0-9][0-9][0-9]/$ index.php?gallery_id=$1
It allows for any number that is three digits in length. I do not know how to allow for less than three digits as well (or more than three for that matter).
I am still new to regex.
Thank-you!
...
consider this string
prison break: proof of innocence (2006) {abduction (#1.10)}
i just want to know whether there is (# floating point value )} in the string or not
i tried few regular expressions like
re.search('\(\#+\f+\)\}',xyz)
and
re.search('\(\#+(\d\.\d)+\)\}',xyz)
nothing worked though...can someone suggest me someth...
How do I use the inline modifiers instead of RegexOptions.Option?
For example:
Regex MyRegex = new Regex(@"[a-z]+", RegexOptions.IgnoreCase);
How do I rewrite this using the inline character i?
http://msdn.microsoft.com/en-us/library/yd1hzczs.aspx
...
What is the most efficient way to remove accents from a string eg.
"ÈâuÑ" becomes "Eaun"
Is there a simple, built in way that I'm missing or a regular expression?
...
What is the best way to remove accents eg.
ÈâuÑ" becomes "Eaun"
Without using iconv
...
I need to find, process and remove (one by one) any substrings that match a rather long regex:
# p is a compiled regex
# s is a string
while 1:
m = p.match(s)
if m is None:
break
process(m.group(0)) #do something with the matched pattern
s = re.sub(m.group(0), '', s) #remove it from string s
The code above is...