ATR Posted October 11, 2011 Share Posted October 11, 2011 (edited) 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 &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>' $Remplacement_espaces = StringRegExpReplace($ur, '[\r|\n]', '') $Telephone = StringRegExp($Remplacement_espaces, '(?s)PubArea sc">\s*.*?<p>(.*?)</', 1) Edited October 11, 2011 by ATR Link to comment Share on other sites More sharing options...
Xenobiologist Posted October 11, 2011 Share Posted October 11, 2011 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 More sharing options...
ATR Posted October 11, 2011 Author Share Posted October 11, 2011 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 & 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>' 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 More sharing options...
Xenobiologist Posted October 11, 2011 Share Posted October 11, 2011 (edited) $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 & 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>' $re = StringRegExp($str, '<p>(\s*.*?)</p>', 3) ConsoleWrite($re[0] & @CRLF) Edited October 11, 2011 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 More sharing options...
ATR Posted October 11, 2011 Author Share Posted October 11, 2011 The problem are the spaces before the text. Link to comment Share on other sites More sharing options...
Xenobiologist Posted October 11, 2011 Share Posted October 11, 2011 $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 More sharing options...
ATR Posted October 11, 2011 Author Share Posted October 11, 2011 Thanks, it works Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now