Re: [PHP] Re: preg guru question

2004-02-14 Thread joel boonstra
On Sat, Feb 14, 2004 at 12:50:55AM -0500, Adam Bregenzer wrote:
> As far as I could tell the regexp I posted was the only one to use a
> subpattern to match the first quote type used and then re-apply that
> after matching the file name:
> '//i'
> 
> I am a bit of a regular expression fan and I would be interested in
> seeing another way to match without using subpatterns.  What was Joel's
> regexp again?

You're right that my regexp[0] didn't require the quote marks to match each
other.  Depending on how strict/lax you want to be, that might be a
feature or a bug ;)

As to doing it without subpatterns... this seems to get there:

  '##i'

but isn't as elegant or extensible as yours, although it does allow for
 (that is, an empty src attribute).  Also, it's less clear
where your matches are in mine, since there are so many parens.

IOW, Adam's is better ;)

[0]: The one I posted was:

  '//i'

which didn't require quotes to match each other, didn't allow for
arbitrary whitespace, and didn't allow for XHTML-style tag closing.

-- 
[ joel boonstra | gospelcom.net ]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: preg guru question

2004-02-13 Thread André Cerqueira
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
lol
i meant you, but i wrote the other name instead...
sorry again
Adam Bregenzer wrote:
On Sat, 2004-02-14 at 00:24, André Cerqueira wrote:

strange bug happened on my newsreader...
'joel boonstra' regex seems to be the better one hehe
all others forgot that if u start with ', u must end with ' hehe (same 
thing with " :p)


As far as I could tell the regexp I posted was the only one to use a
subpattern to match the first quote type used and then re-apply that
after matching the file name:
'//i'
I am a bit of a regular expression fan and I would be interested in
seeing another way to match without using subpatterns.  What was Joel's
regexp again?
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFALdBKaxdA/5C8vH8RAj1mAKDGqh7PJ6ABbngRiKcU25nj1IDZgACg3R7C
yrvcY9EXqu9c2cw2FhilUcg=
=OFjv
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: preg guru question

2004-02-13 Thread Adam Bregenzer
On Sat, 2004-02-14 at 00:24, André Cerqueira wrote:
> strange bug happened on my newsreader...
> 'joel boonstra' regex seems to be the better one hehe
> all others forgot that if u start with ', u must end with ' hehe (same 
> thing with " :p)

As far as I could tell the regexp I posted was the only one to use a
subpattern to match the first quote type used and then re-apply that
after matching the file name:
'//i'

I am a bit of a regular expression fan and I would be interested in
seeing another way to match without using subpatterns.  What was Joel's
regexp again?

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: preg guru question

2004-02-13 Thread André Cerqueira
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
oops...
sorry
strange bug happened on my newsreader...
'joel boonstra' regex seems to be the better one hehe
all others forgot that if u start with ', u must end with ' hehe (same 
thing with " :p)

i dont know why i used square brakets for \s... kinda stupid hehe

André cerqueira wrote:
did you post the same message 7 times?

try:
';
$pattern = '//i';
$matchFound = preg_match_all ($pattern, $subject, $matches, 
PREG_SET_ORDER);

print_r($matches);
//$matches[$i][1] is what really matters
?>
that pattern may not be the best regex to use, but i think it works for 
most cases

Pete M wrote:

Im trying to  scan a file and lift the image name from the 

ie

where there could be ' or "
I messed around but am 2 embarassed to post code cos it dont work ;-(

thanks in advance

pete

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFALbEmaxdA/5C8vH8RArxLAJwNJXHouP4meJXRo4c+8xye12H/4QCgk5gE
YHIReAkKxtFwyD7dLWZIPWc=
=2eBJ
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: preg guru question

2004-02-13 Thread André Cerqueira
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
did you post the same message 7 times?

try:
';
$pattern = '//i';
$matchFound = preg_match_all ($pattern, $subject, $matches, PREG_SET_ORDER);

print_r($matches);
//$matches[$i][1] is what really matters
?>
that pattern may not be the best regex to use, but i think it works for 
most cases

Pete M wrote:

Im trying to  scan a file and lift the image name from the 

ie

where there could be ' or "
I messed around but am 2 embarassed to post code cos it dont work ;-(

thanks in advance

pete
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFALXUxaxdA/5C8vH8RAtlAAKDUHsfEXVlKDZJRAg0I22rtpJxmsQCgjmze
xBmlxQW6SbHMaHV+A/dGydA=
=uxyA
-END PGP SIGNATURE-
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php