Regular Expressions in example
I have a problem with regular expressions:
I want to get text from
--
Jol lala blyszczysz jak szmaragd
--
Could anybody give me an example of doing this?
norito.civ.pl - ksi??ki i ksi??ki i jeszcze raz ksi??ki ^^
I have a problem with regular expressions:
I want to get text from
--
Jol lala blyszczysz jak szmaragd
--
Could anybody give me an example of doing this?
norito.civ.pl - ksi??ki i ksi??ki i jeszcze raz ksi??ki ^^
Wil posted this at 13:29 — 29th November 2002.
They have: 601 posts
Joined: Nov 2001
In what language? Perl, Python, PHP?
gerer posted this at 13:55 — 29th November 2002.
They have: 15 posts
Joined: Nov 2002
PHP. And don't send me to php.net, I've already been there
Wil posted this at 14:49 — 29th November 2002.
They have: 601 posts
Joined: Nov 2001
I'm not going to send you anywhere, but I'm going to wait around for someone who knows PHP to answer your post.
Mark Hensler posted this at 18:52 — 29th November 2002.
He has: 4,048 posts
Joined: Aug 2000
<?php
echo \"<html><body><pre>\n\";
$text = '<a name=\"xxx\">Jol lala blyszczysz jak szmaragd</a>';
if (preg_match('#<a.+>(.*?)</a>#Ui', $text, $matches)) {
// found something..
echo \"pattern found\n\";
print_r($matches);
}
else {
// no pattern found
echo \"no pattern found\n\";
}
echo \"</pre></body></html>\";
?>
output:
pattern found
Array
(
[0] => Jol lala blyszczysz jak szmaragd
[1] => Jol lala blyszczysz jak szmaragd
)
Mark Hensler
If there is no answer on Google, then there is no question.
gerer posted this at 19:49 — 29th November 2002.
They have: 15 posts
Joined: Nov 2002
THX Mark
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.