Connecting Tech Pros Worldwide Help | Site Map

how to write a regular expression?

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 02:15 PM
_andrea
Guest
 
Posts: n/a
Default how to write a regular expression?

I'd like to write a regular expression which match all text between two
<h1>.

I mean:

------------ for: ----------------------
<h1>bla bla [...] \t \r bla \n<h1>
------------- is: -----------------------
bla bla [...] \t \r bla \n


--------------- for: -------------------------
<h1><a name="_Toc104895953"></a><a name="_Toc94324108"></a><a
name="_Toc94268497"></a><a name="_Toc94265711"></a><a
name="_Toc94264823"><span
style='mso-bookmark:_Toc94265711'><span
style='mso-bookmark:_Toc94268497'><span
style='mso-bookmark:_Toc94324108'><span
style='mso-bookmark:_Toc104895953'>2. L'ATTIVITA'
CONTRATTUALE DELLA P.A.</span></span></span></span></a></h1>
bla bla...
[...]
text
<h1>
bla bla...
---------------------------- is: -----------------------------------
<a name="_Toc104895953"></a><a name="_Toc94324108"></a><a
name="_Toc94268497"></a><a name="_Toc94265711"></a><a
name="_Toc94264823"><span
style='mso-bookmark:_Toc94265711'><span
style='mso-bookmark:_Toc94268497'><span
style='mso-bookmark:_Toc94324108'><span
style='mso-bookmark:_Toc104895953'>2. L'ATTIVITA'
CONTRATTUALE DELLA P.A.</span></span></span></span></a></h1>
bla bla...
[...]
text



How to write it?
Thank you in advance,
andrea.



  #2  
Old July 17th, 2005, 02:15 PM
BKDotCom
Guest
 
Posts: n/a
Default Re: how to write a regular expression?

/<H1>(.*?)<\/H1>/is

?

  #3  
Old July 17th, 2005, 02:15 PM
_andrea.l
Guest
 
Posts: n/a
Default Re: how to write a regular expression?

How can I use it?
what does it means /is?
this is a perl format, I can use it whith php and how?

Thank you in advance,
Andrea.

"BKDotCom" <bkfake-google@yahoo.com> ha scritto nel messaggio
news:1121358837.631809.134960@g44g2000cwa.googlegr oups.com...[color=blue]
> /<H1>(.*?)<\/H1>/is
>
> ?
>[/color]


  #4  
Old July 17th, 2005, 02:15 PM
Peter van Schie
Guest
 
Posts: n/a
Default Re: how to write a regular expression?

_andrea.l wrote:[color=blue]
> How can I use it?
> what does it means /is?
> this is a perl format, I can use it whith php and how?[/color]

Use preg_match()
With the regular expression and the subject as arguments.
See: http://nl2.php.net/manual/en/function.preg-match.php

--
http://www.phpforums.nl
  #5  
Old July 17th, 2005, 02:15 PM
petermichaux@yahoo.com
Guest
 
Posts: n/a
Default Re: how to write a regular expression?

I think you are looking for this

http://ca3.php.net/preg-match

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.