elmoi0010 Posted January 19, 2014 Posted January 19, 2014 Hello gusy i want to remove dashed from a text. I removed spaced with "StringStripWS" but i want to remove dashes now. i tryed wirh " StringRegExpReplace " but its not working i dont know. this is my code: $sPhoneNumber = _StringBetween(_IEDocReadHTML($oIE) , 'Phone Number:</b> ', '</TD>') If Not @error then MsgBox(4096,"Info", $sPhoneNumber[0]) Else MsgBox(4096,"Error", "Can not find phone number") EndIf Anyone can help me ?
Unc3nZureD Posted January 19, 2014 Posted January 19, 2014 Could you give us an example of how the _IEDocReadHTML($oIE) looks like?
Moderators Melba23 Posted January 19, 2014 Moderators Posted January 19, 2014 elmoi0010,Have you tried StringReplace - it is simpler to use than its SRER cousin. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
elmoi0010 Posted January 19, 2014 Author Posted January 19, 2014 Could you give us an example of how the _IEDocReadHTML($oIE) looks like?
michaelslamet Posted January 19, 2014 Posted January 19, 2014 (edited) StringReplace($sPhoneNumber[0], "-", "") edit: correcting fatal typo in code Edited January 19, 2014 by michaelslamet
Danp2 Posted January 19, 2014 Posted January 19, 2014 Why not use StringReplace if all you need to do is remove the dashes? Latest Webdriver UDF Release Webdriver Wiki FAQs
elmoi0010 Posted January 19, 2014 Author Posted January 19, 2014 elmoi0010, Have you tried StringReplace - it is simpler to use than its SRER cousin. M23 i tryed the example of stringreplace webpage ---> source, and it work but i tryed to implement to my code but its not working :S.
Moderators Melba23 Posted January 19, 2014 Moderators Posted January 19, 2014 elmoi0010, my code but its not workingAnd how do you think that is going to help us find a solution? Please post the code which does not work - see here how to do it. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
elmoi0010 Posted January 19, 2014 Author Posted January 19, 2014 StringReplace($sPhoneNumber[0], "-', "") i get this bro:
michaelslamet Posted January 19, 2014 Posted January 19, 2014 Sorry it should be "-" Sorry for the typo i am typing from a phone
Solution elmoi0010 Posted January 19, 2014 Author Solution Posted January 19, 2014 Sorry it should be "-" Sorry for the typo i am typing from a phone Thanks you so much bro it works <3 you are the best !
Jury Posted January 19, 2014 Posted January 19, 2014 (edited) There are several types of hyphens and dashes you may try this: p{Pd} or p{Dash_Punctuation}: any kind of hyphen or dash as in: StringRegExpReplace($filewhole1, '(*UCP)\p{Pd}', '-') seems to work for me. From http://en.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions: Since version 8.10, matching of certain "normal" metacharacters can be driven by Unicode properties when the compile option PCRE_UCP is set. The option can be set for a pattern by including (*UCP) at the start of pattern. In fact if you go here and scroll down to Unicode Categories you'll find lots of interesting regex expressions we now can use. Some work in ascii and unicode encoding - give them a try! http://www.regular-expressions.info/unicode.html Joe Edited July 3, 2014 by Jury
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