Jump to content

RegExp betwen whitespace


ATR
 Share

Recommended Posts

Hi all,

I want to extract my sentence that is between whitespace.

The result is " Installation, Maintenance, Assistance, Sécurité réseau, Création de sites web. Particuliers & professionnels PC & MAC "

And I want "Installation, Maintenance, Assistance, Sécurité réseau, Création de sites web. Particuliers & professionnels PC & MAC"

Thanks.

$ur = '<div class="PubArea sc">' & @CRLF & _
'        <div class="infoLinks">' & @CRLF & _
'    </div>' & @CRLF & _
'' & @CRLF & _
'' & @CRLF & _
'<p>' & @CRLF & _
'             Installation, Maintenance, Assistance, Sécurité réseau, Création de sites web. Particuliers & professionnels PC & MAC </p>' & @CRLF & _
'     <p class="sitePro">' & @CRLF & _
'                 Site internet : ' & @CRLF & _
'    <a class="JS_PJ { pjlienbrouille :{url:"#aHR0cDovL3d3dy5hdHItaW5mb3JtYXRpcXVlLmNvbQ=="}} external aTag_INFO idTag_LVS-PAYANT aAladinAnnonceur_YES-BLOC_ANNONCEUR-LIEN_ANNONCEUR-SITE_WEB-52809704000001C0001-SITE_WEB " title="Lien externe" href="#null" target="blank" data-pjstatsXiti="{typeBloc:}">www.atr-informatique.com</a></p>' & @CRLF & _
'' & @CRLF & _
'           </div>'
$Remplacement_espaces = StringRegExpReplace($ur, '[\r|\n]', '')
$Telephone = StringRegExp($Remplacement_espaces, '(?s)PubArea sc">\s*.*?<p>(.*?)</', 1)
Edited by ATR
Link to comment
Share on other sites

What is your string before ?

Please post this

Original text

what you want to extract.

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

My string before is :

'<div class="PubArea sc">' & @CRLF & _

' <div class="infoLinks">' & @CRLF & _

' </div>' & @CRLF & _

'' & @CRLF & _

'' & @CRLF & _

'<p>' & @CRLF & _

' Installation, Maintenance, Assistance, Sécurité réseau, Création de sites web. Particuliers &amp; professionnels PC &amp; MAC </p>' & @CRLF & _

' <p class="sitePro">' & @CRLF & _

' Site internet : ' & @CRLF & _

' <a class="JS_PJ { pjlienbrouille :{url:"#aHR0cDovL3d3dy5hdHItaW5mb3JtYXRpcXVlLmNvbQ=="}} external aTag_INFO idTag_LVS-PAYANT aAladinAnnonceur_YES-BLOC_ANNONCEUR-LIEN_ANNONCEUR-SITE_WEB-52809704000001C0001-SITE_WEB " title="Lien externe" href="#null" target="blank" data-pjstatsXiti="{typeBloc:}">www.atr-informatique.com</a></p>' & @CRLF & _

'' & @CRLF & _

' </div>'

and I want extract : "Installation, Maintenance, Assistance, Sécurité réseau, Création de sites web. Particuliers & professionnels PC & MAC"

Link to comment
Share on other sites

$str = '<div class="PubArea sc">' & @CRLF & _

' <div class="infoLinks">' & @CRLF & _

' </div>' & @CRLF & _

'' & @CRLF & _

'' & @CRLF & _

'<p>' & @CRLF & _

' Installation, Maintenance, Assistance, Sécurité réseau, Création de sites web. Particuliers &amp; professionnels PC &amp; MAC </p>' & @CRLF & _

' <p class="sitePro">' & @CRLF & _

' Site internet : ' & @CRLF & _

' <a class="JS_PJ { pjlienbrouille :{url:"#aHR0cDovL3d3dy5hdHItaW5mb3JtYXRpcXVlLmNvbQ=="}} external aTag_INFO idTag_LVS-PAYANT aAladinAnnonceur_YES-BLOC_ANNONCEUR-LIEN_ANNONCEUR-SITE_WEB-52809704000001C0001-SITE_WEB " title="Lien externe" href="#null" target="blank" data-pjstatsXiti="{typeBloc:}">www.atr-informatique.com</a></p>' & @CRLF & _

'' & @CRLF & _

' </div>'

$re = StringRegExp($str, '<p>(\s*.*?)</p>', 3)

ConsoleWrite($re[0] & @CRLF)

Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

$re = StringRegExp($str, '<p>\s*(.*?)\s*</p>', 3)

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...