f



preg_match(): Compilation failed: regular expression too large

preg_match(): Compilation failed: regular expression too large at
offset 0

The regular expression is 34,745 bytes long.

<?php
$regExp = 'huge regexp with 34,745 bytes';
echo '<pre>strlen($regExp) = ', strlen($regExp), "\n";
echo preg_match($regExp, 'sudokusweb.com');
echo '</pre>';
?>

This error shows in Fedora Core 5 - PHP 5.4.1

The same code works in a shared host running PHP 4.3.11:

http://allthehosts.com/testregex.php

The code including the regexp can be downloaded from:

http://allthehosts.com/testregex.txt

Regards, Clodoaldo Pinto

0
9/4/2006 9:21:09 PM
comp.lang.php 32646 articles. 0 followers. Post Follow

4 Replies
1863 Views

Similar Articles

[PageSpeed] 1

On 4 Sep 2006 14:21:09 -0700, "Clodoaldo Pinto" <clodoaldo.pinto@gmail.com>
wrote:

>preg_match(): Compilation failed: regular expression too large at
>offset 0
>
>The regular expression is 34,745 bytes long.
>
><?php
>$regExp = 'huge regexp with 34,745 bytes';
>echo '<pre>strlen($regExp) = ', strlen($regExp), "\n";
>echo preg_match($regExp, 'sudokusweb.com');
>echo '</pre>';
>?>
>
>This error shows in Fedora Core 5 - PHP 5.4.1
>
>The same code works in a shared host running PHP 4.3.11:
>
>http://allthehosts.com/testregex.php
>
>The code including the regexp can be downloaded from:
>
>http://allthehosts.com/testregex.txt


 See the LIMITATIONS section of http://www.pcre.org/pcre.txt

 There are compile-time options that may allow longer expressions, possibly
these differ between the two sites.

 However, that's one big beastie of an expression, most of which is just
alternation - you *could* run it as a series of smaller expressions.

-- 
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
0
andy171 (2271)
9/4/2006 9:46:24 PM
Andy Hassall wrote:
> On 4 Sep 2006 14:21:09 -0700, "Clodoaldo Pinto" <clodoaldo.pinto@gmail.com>
> wrote:
>
> >preg_match(): Compilation failed: regular expression too large at
> >offset 0
> >
> >The regular expression is 34,745 bytes long.
> >
>  See the LIMITATIONS section of http://www.pcre.org/pcre.txt

       The  maximum  length of a compiled pattern is 65539 (sic) bytes
if PCRE
       is compiled with the default internal linkage size of 2.

Then I suppose FC5 does not compile it with the default size of 2

This is from phpinfo():

Configure Command 	 './configure' '--build=x86_64-redhat-linux'
'--host=x86_64-redhat-linux' '--target=x86_64-redhat-linux-gnu'
'--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr'
'--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
'--datadir=/usr/share' '--includedir=/usr/include'
'--libdir=/usr/lib64' '--libexecdir=/usr/libexec'
'--localstatedir=/var' '--sharedstatedir=/usr/com'
'--mandir=/usr/share/man' '--infodir=/usr/share/info'
'--cache-file=../config.cache' '--with-libdir=lib64'
'--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d'
'--disable-debug' '--with-pic' '--disable-rpath' '--without-pear'
'--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin'
'--with-freetype-dir=/usr' '--with-png-dir=/usr'
'--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp'
'--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png'
'--with-pspell' '--with-expat-dir=/usr' '--with-pcre-regex=/usr'
'--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp'
'--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem'
'--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars'
'--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos'
'--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr'
'--enable-memory-limit' '--enable-shmop' '--enable-calendar'
'--enable-dbx' '--enable-dio' '--with-mime-magic=/etc/httpd/conf/magic'
'--without-sqlite' '--with-libxml-dir=/usr' '--with-xml'
'--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd'
'--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC'
'--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter'

Regards, Clodoaldo Pinto

0
9/4/2006 9:56:35 PM
"Clodoaldo Pinto" <clodoaldo.pinto@gmail.com> wrote in message 
news:1157404869.431371.54580@e3g2000cwe.googlegroups.com...
> preg_match(): Compilation failed: regular expression too large at
> offset 0
>
> The regular expression is 34,745 bytes long.


That's not a regular expression, that's an Operating System... What the heck 
are you trying to do with it? Validate the Universe? :-)


-- 
"Ohjelmoija  on  organismi  joka  muuttaa  kofeiinia  koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti p�ivittyv� nettisarjis
spam@outolempi.net || Gedoon-S @ IRCnet || rot13(xvzzb@bhgbyrzcv.arg) 


0
spam4297 (354)
9/5/2006 6:29:48 AM
Kimmo Laine wrote:
> "Clodoaldo Pinto" <clodoaldo.pinto@gmail.com> wrote in message
> news:1157404869.431371.54580@e3g2000cwe.googlegroups.com...
> > preg_match(): Compilation failed: regular expression too large at
> > offset 0
> >
> > The regular expression is 34,745 bytes long.
>
>
> That's not a regular expression, that's an Operating System... What the heck
> are you trying to do with it? Validate the Universe? :-)

That is for a SMF Spam Black List Mod:
http://www.simplemachines.org/community/index.php?topic=109614.0

I fixed it breaking the regexp into smaller pieces.

Regards, Clodoaldo Pinto

0
9/5/2006 1:49:19 PM
Reply:

Similar Artilces:

why does this regular expression fail?
Suppose I have these five lines in a file somewhere: <p>This entry should belong to: <select name="formInputs[id_of_neighborhood_to_which_this_belongs]"> <option value="">(No choice made)</option> <?php getDatabaseTableValuesInOptionTags("neighborhoods", "id", "state"); ?> </select> Suppose I open this file and read the contents into a string called $string. Suppose I then give the string to this function: function matchAllPhpFunctionsInString($subject=false) { // 11-08-06 - this is being called in importForm $pattern = "<"; $pattern .= "\?php.*\(.*\); \?"; $pattern .= ">"; $pattern = "/$pattern/"; preg_match_all($pattern, $subject, $matches); // print_r($matches); // 09-19-06 - there is no point returning a 2 dimensional array, so we will make // it one dimensional. $arrayOfPhpFunctionNames = $matches[0]; return $arrayOfPhpFunctionNames; } This function is suppose to find the PHP command. It works on other pages, but not the one I've posted above. Why is that? Why would this regular expression not find this PHP command? lawrence k wrote: > Suppose I have these five lines in a file somewhere: > > <p>This entry should belong to: > <select name="formInputs[id_of_neighborhood_to_which_this_belongs]"> > <option value="">(No choice made)</option> > <?php getDa...

PHP regular expressions
Hello, I am writing an elearning software with php. I need a script to recognize any inut of the type ab,aabb,aaabbb,aaaabbbb..... And so on. Could anyone tell me how can I do this using regular expressions? Regards, Albert Achtenberg Albert <albert@arbel-designs.com> wrote: > I am writing an elearning software with php. I need a script to > recognize any inut of the type ab,aabb,aaabbb,aaaabbbb..... And so on. > Could anyone tell me how can I do this using regular expressions? So basically you need a regexp tutorial. I don't know any but studing http://nl.php.net/manual...

C++ regular expression Vs. Perl regular Expression
Hi all, In Perl the RegExpr is very good use, it allows programmer to do everything they want to do, start from simple text file to a large programm parsing user input. However, I never come across C++ regular expression that able to do what perlist can do???? Thank. [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] "phal" <betterdie@gmail.com> writes: > Hi all, > > In Perl the RegExpr is very good use, it allows programmer to do > everything they want to do, start from simpl...

PHP and regular expressions #2
Hi, I'm new to this group and regular expressions. I want to extract text from a newspaper website using regular expressions and php I'm using this regular expression at the moment $regexp = "%<table cellspacing=\"0\" cellpadding=\"0\"> (.+) <img height=\"1\" alt=\"Today's News\" />%s"; Each news story is in between those tags , So if I extract those chunks of html using preg_match($regexp,$document,$matches); where $document is a handle on the file. I can store them in %matches for further processing. Alas it does not work and i cannot figure out why Can anyone help? Thanks __where $document is a handle on the file__ the 2nd parameter should be a string read the file to a string... Do you really want the space around "(.+)" ? you can clean this up by enclosing it in '' rather than "" $regexp = '%<table cellspacing="0" cellpadding="0"> (.+) <img height="1" alt="Today's News" />%s'; On Feb 28, 12:03 pm, "Damo" <cormacdeba...@gmail.com> wrote: > Hi, > I'm new to this group and regular expressions. I want to extract text > from a newspaper website using regular expressions and php > I'm using this regular expression at the moment > > $regexp = "%<table cellspacing=\"0\" cellpadding=\"0\"> (.+) <img > height=\"1\" alt=...

RE: Compiling Regular Expressions
> I have a co-worker who wrote a little program to search for > particular phrases in a logfile to process the error > messages. [...] > Any ideas of how I could do what we want to do without taking > almost 20 times longer to process? Have you tried tried a CPAN module that does logfile error detection? Log::Detect seems to do what you're trying to do. If nothing else, the speed of that module can become a benchmark for yours. -- Mark. ----- End forwarded message ----- ...

Help me with a regular expression for PHP
I have no idea where to get help on RE stuff. Since it's for a PHP app I thought I would ask here to see if there was some RE pros. Basically I'm doing some template stuff and I wanted to use a preg_replace_callback function to call another function when the criteria of the RE expression is matched but have no idea how to accomplish it. So I start with this: /<(input|select|textarea)[^>]*name\s*\=\s*\"[_a-zA-Z0-9\s]*\"[^>]*>/ but need to modify it so it only matches if it has '{' characters in the name but to not match if it does not. So this would not match: <input name="test"> But this would match: <input name="test{0}"> Thanks much in advance. cendrizzi wrote: > So I start with this: > /<(input|select|textarea)[^>]*name\s*\=\s*\"[_a-zA-Z0-9\s]*\"[^>]*>/ You'd better not use regular expressions to validate HTML. The following line is perfectly valid HTML (I think in any version) <input type="text" name="x><y" id="xy"> > but need to modify it so it only matches if it has '{' characters in > the name but to not match if it does not. > > So this would not match: > <input name="test"> > > But this would match: > <input name="test{0}"> Get the name. Verify it has '{' and '}' (in that order and once only?) <?php $name = get_name(&#...

regular expression compilation aborted
Hi folks, I have the problem regarding the compilation of the regular expression. I have given the regular expression as follows: "(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ([ 0-9][0-9]) ([0-9][0-9])(.*)" and regcomp() function call gets aborted ( i think it is because of the increased memory consumption at the time of regular expression compilation ). What is the reason behind this ? Please put some light on the problem, Thanks in advance, torpedo torpedo@bluebottle.com writes: > Hi folks, > > I have the problem regarding the compilation of the regular expr...

Question on PHP regular expressions
In PHP I have many more options for functions that do regular expression than I did in Perl. My question is what is the best one to use for doing the following: Give the following: {Somestring.somestring.somestring} blah blah {somestring} value here not used {more.text.here} I want an array like the following: [0] => Somestring.somestring.somestring [1] => somestring [2] => more.text.here So basically I just want to capture the contents (alpha-numeric + periods) inside of curly braces. Thanks for any help. sberry <sean@buildingonline.com> writes: > In PHP I have many more options for functions that do regular > expression than I did in Perl. My question is what is the best one to > use for doing the following: > > Give the following: > {Somestring.somestring.somestring} blah blah {somestring} value here > not used {more.text.here} > > I want an array like the following: > [0] => Somestring.somestring.somestring > [1] => somestring > [2] => more.text.here > > So basically I just want to capture the contents (alpha-numeric + > periods) inside of curly braces. > > Thanks for any help. This should get you started: $string = "{Somestring.somestring.somestring} blah blah {somestring} value here not used {more.text.here}"; $pattern = '/\{.+?\}/'; preg_match_all($pattern, $string, $matches); print_r($matches); Hope that helps, On Nov 8, 11:17 am, Carl <c.gro...@gmail.com>...

Regular expression guaranteed to fail
I want to use sets and regular expressions to implement some linguistic ideas. Representing sounds by symbols, and properties (coronal or velar articulation; voicedness) by sets of symbols with those properties, it is natural to then map these sets, and intersections of them, to regular expressions to apply to strings. The question is, what regular expression should correspond to the empty set? I've provisionally gone with "(?!.*)", i.e., the negation of a look-ahead which matches anything. Is there an established idiom for this, and is that it? And if there isn't, does ...

Compilation failed for large file
Hi, Please find PRF below. ACE VERSION: ACE 5.5 HOST MACHINE and OPERATING SYSTEM: AIX 5.3 COMPILER NAME AND VERSION (AND PATCHLEVEL): Visual Age 6 xlC_r THE $ACE_ROOT/ace/config.h FILE #define _LARGE_FILES config-aix-5.x.h THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE platform_aix_ibm.GNU AREA/CLASS/EXAMPLE AFFECTED: Support for LARGEFILE in AIX DOES THE PROBLEM AFFECT: COMPILATION SYNOPSIS: ACE Compilation failed DESCRIPTION: If I tried to comlied ACE in AIX with large file support, it is giving error while compilation. "Naming_Context.cpp", line 592.14: 1540-0217 (S) "open64" is not a member of "class ACE_Log_Msg". if we didnt give _LARGE_FILES in config.h then it is compiling but file operation like stat , open , lseek etc are failing for large files. Is there any way we can handle large file in AIX ? Waiting for your reply Manish Hi Mann, > Please find PRF below. Thanks for usin gthe PRF. > ACE VERSION: ACE 5.5 Please upgrade to ACE+TAO+CIAO x.6.2 (i.e., ACE 5.6.2, TAO 1.6.2, and CIAO 0.6.2), which you can download from http://download.dre.vanderbilt.edu under the heading: "Latest Beta Kit." The DOC groups at Washington University, UC Irvine, and Vanderbilt University only provide "best effort" support for non...

Regular expression from end of another regular expression till end of line
Hi, There are lines which have numerical substrings of 15 or 16 characters length in them. The regular expression (\d{15,16}) matches this string. I want to extract the portion after this 15/16 character string till end of the line. Can this be done using a regular expression? Thanks in advance for the help. Regards, Raj On 5/1/2010 6:31 AM, Rajendra wrote: > Hi, > > There are lines which have numerical substrings of 15 or 16 characters > length in them. > > The regular expression (\d{15,16}) matches this string. I want to > extract the portion after this 15/16 chara...

Regular expression example on PHP.net
Howdy folks, On this page at php.net http://www.php.net/features.http-auth there's a regular expression in Example 34.2. It's supposed to parse out the different values being passed in the header. I know what it's supposed to do, so I have a vague idea of what's being done in the RE, but I've been having a heck of a time figuring out what each part of the RE is actually doing. Here's what I have so far: preg_match_all('@(\w+)=(?:([\'"])([^\2]+)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER); //'@ //(\w+) Any word character (letter/digit/_), 1 or more //= Equal sign //(?: This submatch will not be captured (still available for later matching) //([\'"]) A single or double quote //([^\2]+) Not start of text (STX)?, 1 or more //\2| //([^\s,]+) Not whitespace or comma, 1 or more //) //@' I'm unclear as to what the second \2 does, as well as which parts the OR applies to. And what are the @s for? Thanks for any help, ZF -- Posted via a free Usenet account from http://www.teranews.com On Fri, 07 Sep 2007 08:02:07 +0200, Zenofobe <fake_email@fake_domain.com= > = wrote: > Howdy folks, > > On this page at php.net > http://www.php.net/features.http-auth > there's a regular expression in Example 34.2. It's supposed to parse = out > the different values being passed in the header. I know what it's > supposed to do, so I have a vague i...

Converting PERL regular expression to PHP?
Hi, I'm in the process of converting some PERL to PHP. Thus, is it possible to leave the following line as is: if ($id =~ /vvvvv/g) { ... } If not, can someone provide PHP equivalent? BTW, I have checked the syntax using 'php -l' because I'm not an expert of PERL but I'm using various references to do the conversion. However, I was able to locate this particular construct. Thanks in advance, -Conrad Hi, the last couple of sentences should read: If not, can someone provide PHP equivalent? BTW, I have checked the syntax using 'php -l'. Also, I'...

compiling case insensitive regular expressions
Hello, I need to compile regular expressions which are case insensitive, there are two cases, the part which must be matched case insensitvely might be just a portion but it can be the entire RE as well. The RE will be Unicode enabled and must be compiled to AFD. I am wondering what is the "best practice" in this field, is it generally more efficient to precompute for each RE its "case insensitive RE" (by replacing each symbol by a ORed version of it, i.e; hello becomes (h|H)(e|E)(l|L)(l|L)(o|O)..) and compile that in place of the original or is it as good to simply repl...

Regular expression fails to replace but matches
<pre> <code> // PATTERN: (<c:param.+value=")<%=[ \t]*([^%]+)[ \t]*%>(".*$) Pattern p = Pattern.compile("(<c:param.+value=\")<%=[ \\t]*([^ \\t%] +)[ \\t]*%>(\")"); Matcher matcher = p.matcher(stuff); Pattern p2 = matcher.pattern(); System.out.println(p2.pattern()); if (matcher.find()) { System.out.println("Found erroneous pattern \"<%= %>\" within \"" + file.getName() + "\", converting now"); stuff = matcher.replaceAll("$1${$2}$3"); } </code> </pre> This code works to find the JSTL tag pattern: <pre> <c:param name="[whatever]" value="<%= [whatever else] %>" /> </pre> But no pattern substitution takes place. I do not understand why this fails to replace the pattern but successfully finds the pattern. Any ideas why? Is this more proof that Java can't handle regular expressions? On 25/08/2008 16:56, phillip.s.powell@gmail.com allegedly wrote: > <pre> > <code> > // PATTERN: (<c:param.+value=")<%=[ \t]*([^%]+)[ \t]*%>(".*$) > Pattern p = Pattern.compile("(<c:param.+value=\")<%=[ \\t]*([^ \\t%] > +)[ \\t]*%>(\")"); > Matcher matcher = p.matcher(stuff); > Pattern p2 = matcher.pattern(); > System.out.println(p2.pattern()); > if (matcher.find()) { > System.out.println("Found errone...

check object being a compiled regular expression
Hi, sorry, this seems to be a FAQ but I couldn't find anything I need to check if an object is a compiled regular expression Say import re RX= re.compile('^something') how to test "if RX is a compiled regular expression" type(RX) says <type '_sre.SRE_Pattern'> but if isinstance(RX,_sre.SRE_Pattern) and if isinstance(RX,re._sre.SRE_Pattern) both fail. Many thanks for a hint, Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany This is crude, but works: >>> import re >>> RX= re.com...

import large outlook express setup fails
I am a long time user of Outlook Express but need to convert to Eudora. I have thousands of stored messages in a complex folder structure. The automatic import of email fails. Are there other methods that may work? ...

Regular Expression for replacing images through URLs in PHP
Hi! I want to replace images through URLs with the help of a regular expression. For example: <img src='http://xxxxx.net/photo/small.jpg'> should be replaced through: <a href='http://xxxxx.net/photo/small.jpg'>Link</a> Another problem are emoticons, which are also included as <img>. Therefore I would like to extend the upper regular expression that the image should only be replaced through an URL, if the src attribute of the img tag does not start with "/modules/emoticons/". Thanks in advance, Markus On Tue, 19 Jul 2005 10:31:30 +02...

What is regular about regular expressions nowadays?
The language {ww | w is alpha} has been shown to be context-sensitive. But the perl regular expression /(\w*)\1/ will recognize it. There are constructs supported by some regex engines (.NET, for example) that allow sections to be tagged and Why do we insist on calling these "regular"? Anything with back-references or tagging of any sort can't be expressed as DFAs or NFAs because one is not supposed to be able to keep a memory of the input. Still, all books that talk about regex engines talk about NFAs and backtracking. Something like {ww} requires an equivalent LBA (linear bou...

assigning alternativ value if a regular expression has failed
Hello, I am using regular expressions to filter words and numbers from $_ and assign them to $1 and $2 for further use $_ =~ m/(.*?)(-{0,1}\d+)$/; How can I assign an alternative value to $1 and $2 if the regular expression failed? (sometimes no there is no input, so I want to record a failure message) Problem is: the digit "0" is a possible value in $1 or $2 I was trying if(!$1){ $var="alternativ values"; } else{ $var=$1; } or if($1 eq undef){ $var="alternativ values"; } .... How cann I check whether a $scalar exists or not? Is there somethin...

compile fail as regular user but ok as root on linux
I compile my java programs with tomcat & axis successfully as root on linux. I setup myself with sudo privilege but compiling them as regular (non- root) user fail. $ set |grep HOME ANT_HOME=/usr/local/ant/apache-ant-1.7.1 AXIS2_HOME=/opt/axis2-1.1.1 CATALINA_HOME=/usr/local/apache-tomcat-6.0.13 HOME=/home/powah JAVA_HOME=/home/powah/jdk1.6.0_06 # visudo .... powah ALL= /usr/src/redhat/, /bin/touch, /bin/mv, /bin/rm, /usr/bin/ perl makeMY.pl $ sudo perl makeMY.pl .... /usr/tomcat/bin/tomcat-native-1.1.8-src/jni/native/include -I/home/ powah/jdk1.6.0_06/include -I/home/powah/jdk1.6.0_0...

Regular expressions, compilation & tcl 8.6...
Hi all, Has anything changed noticeably in the cache Tcl uses for caching regular expressions? I tried to verify a large set (thousands) of small & simple regular expressions, with "regexp $one {}" and Tcl resulted in occupying 800MB or RAM. Is this expected? (I remembered that the last N expression compilations were kept in memory...) George set patterns [<return a list of regexp patterns>] ## Ensure all patterns are valid! foreach one $patterns { if {[catch {regexp $one {}} error]} { error "Invalid pattern: $one\n$error" } } On Nov 12, 1:21=A0am, Georgios Petasis <peta...@iit.demokritos.gr> wrote: > Hi all, > > Has anything changed noticeably in the cache Tcl uses for caching > regular expressions? > > I tried to verify a large set (thousands) of small & simple regular > expressions, with "regexp $one {}" and Tcl resulted in occupying 800MB > or RAM. Is this expected? > > (I remembered that the last N expression compilations were kept in > memory...) > > George > > set patterns [<return a list of regexp patterns>] > ## Ensure all patterns are valid! > foreach one $patterns { > =A0 =A0if {[catch {regexp $one {}} error]} { > =A0 =A0 =A0error "Invalid pattern: $one\n$error" > =A0 =A0} I don't know of a specific cache in the RE engine; however there's the Tcl_Obj internal rep which plays the same role. Since the compiled aut...

php regular expression doesn't match
Hi PHP's regular expression look like doesn't support .*? syntax. So i cannot match the shortest match. For exmaple: $str="a1b a3b"; $str1=ereg_replace("a.*b", "peter", $str1); will produce "peter", but i want "peter peter", so how to? thanks from Peter (cmk128@hotmail.com) cmk128@hotmail.com wrote: > Hi Hi, > PHP's regular expression look like doesn't support .*? syntax. So i > cannot match the shortest match. For exmaple: > > $str="a1b a3b"; Typo. That was $str1="a1b a3b" I expect. > $str1=ereg_replace("a.*b", "peter", $str1); > will produce "peter", but i want "peter peter", so how to? > Yes, * is greedy. I do not know your real-world example, but maybe using a wordboundary can solve your problem? eg: $str1=ereg_replace("/a.*b\b/", "peter", $str1); > thanks > from Peter (cmk128@hotmail.com) > Regards, Erwin Moller Erwin Moller wrote: > cmk128@hotmail.com wrote: >> Hi > > Hi, > >> PHP's regular expression look like doesn't support .*? syntax. So i >> cannot match the shortest match. For exmaple: >> >> $str="a1b a3b"; > > Typo. That was $str1="a1b a3b" I expect. > >> $str1=ereg_replace("a.*b", "peter", $str1); >> will produce "peter", but i want "p...

Regular Expression for Prime Numbers (or How I came to fail at them, and love the bomb)
I was reading up on this site [http://www.noulakaz.net/weblog/ 2007/03/18/a-regular-expression-to-check-for-prime-numbers/] of an interesting way to work out prime numbers using Regular Expression. However my attempts to use this in Python keep returning none (obviously no match), however I don't see why, I was under the impression Python used the same RE system as Perl/Ruby and I know the convert is producing the correct display of 1's...Any thoughts? def re_prime(n): import re convert = "".join("1" for i in xrange(n)) return re.match("^1?$|^(11+...

Web resources about - preg_match(): Compilation failed: regular expression too large - comp.lang.php

Other compilation albums of Westlife - Wikipedia, the free encyclopedia
The album consists of a range of well known hits, remixes, b-sides and international language versions. "Don't Calm The Storm" and "I Won't Let ...

Emma Watson American Accent Funny Compilation - YouTube
Like My Facebook Page http://www.facebook.com/emmaniacs A Compilation of Emma Watson's American Accent

Animals in Super Bowl Ads: Video Compilation - Special: Super Bowl - AdAge
Cheetahs and horses and bears, oh my! Spots featuring fuzzy, scaly and winged creatures are a time-honored tradition in the Super Bowl. Over ...

Instagram Spotlight Compilations to Shine More Frequently
Instagram launched curated content streams called Spotlight Compilations this past Halloween, and the Facebook-owned photo- and video-sharing ...

A compilation of people hurting themselves on their new Christmas Hoverboards
Hoverboards might not be safe or legal in all places, but they’re definitely popular gifts, especially around Christmas , but controlling these ...

Saetia releasing discography compilation on Touche Amore frontman's label, streaming live album; M/R ...
Short-lived screamo greats Saetia already released the career-spanning compilation A Retrospective in 2001, and this year they'll release another ...

2015 Cute and Funny Animals Compilation
Submitted by: (via kyoot animals ) Tagged: dogs , ducks , cute , Cats , funny , Video , animals Share on Facebook

Compilation: Curry's record-setting 128 3-pointers
... Login Search form Search 58° Navigation Home Giants A's Sharks Warriors Kings 49ers Raiders Quakes Insiders More Tickets Shop Watch Compilation: ...

A Compilation Of Every Time R2-D2 Saved The Day
This is a compilation of every time R2-D2 saves the day in the first six Star Wars movies. He deserves a medal. Without him, pretty much everybody ...

WATCH: New ISIS Video Is Compilation of Beheadings & Hand Amputations
In a new video purportedly released by the Islamic State, footage of previous violence committed by ISIS is set to…

Resources last updated: 3/23/2016 10:11:46 PM