Sign in to follow this  
Followers 0
elmoi0010

Remove dashes from text ?

12 posts in this topic

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 ?

Share this post


Link to post
Share on other sites



Could you give us an example of how the

_IEDocReadHTML($oIE)

looks like?

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Could you give us an example of how the

_IEDocReadHTML($oIE)

looks like?

screenshot_33.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

StringReplace($sPhoneNumber[0], "-", "")

edit: correcting fatal typo in code

Edited by michaelslamet

Share this post


Link to post
Share on other sites

Why not use StringReplace if all you need to do is remove the dashes?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

elmoi0010,

 

my code but its not working

And 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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

StringReplace($sPhoneNumber[0], "-', "")

i get this bro: screenshot_34.png

Share this post


Link to post
Share on other sites

Sorry it should be "-"

Sorry for the typo i am typing from a phone :)

Share this post


Link to post
Share on other sites

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 :D!

Share this post


Link to post
Share on other sites

#12 ·  Posted (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 by Jury

Share this post


Link to post
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
Sign in to follow this  
Followers 0