Jump to content
Sign in to follow this  
sambalec

Cut string :(

Recommended Posts

sambalec

Hello, I need to cut this string to just have "test@test.com" ( email could be variable ) :

"i'+'lto:'+qxs+plb+jab+szu+giq+att+'">'+'test@test.com'+'</a>');

</blabla><test> <b>testtest</b></test></td>"

So i need to have email between '+'

Another string cut... I would like to cut this string :

"blablablabla TEstSambalec" or

"bliblibliblibli TEstSambalec" or

"tadadadaa TEstSambalec"

I need to have "Sambalec" :D

Thanks a lot !

Share this post


Link to post
Share on other sites
Authenticity

You mean to copy it to the clipboard or to cut it from the control?

Share this post


Link to post
Share on other sites
sambalec

Yes string in variable

Share this post


Link to post
Share on other sites
Authenticity

Oh, you mean - extracting it.

Look at the String* functions.

For example:

Dim $sMail = 'toto@hotmail.com'
Dim $sVar ="i'+'lto:'+qxs+plb+jab+szu+giq+att+'"">'+'test@test.com'+'</a>');"& _
                  "</blabla><test> <b>testtest</b></test></td>"

$sVar = StringRegExpReplace($sVar, '+', $sMail)
ConsoleWrite($sVar & @LF)

Or you mean something different?

Edit: Pff...

Edited by Authenticity

Share this post


Link to post
Share on other sites
sambalec

No to remplace this email, but to take email between '+'

Share this post


Link to post
Share on other sites
PsaltyDS

Hello, I need to cut this string to just have "test@test.com" ( email could be variable ) :

"i'+'lto:'+qxs+plb+jab+szu+giq+att+'">'+'test@test.com'+'</a>');

</blabla><test> <b>testtest</b></test></td>"

So i need to have email between '+'

Another string cut... I would like to cut this string :

"blablablabla TEstSambalec" or

"bliblibliblibli TEstSambalec" or

"tadadadaa TEstSambalec"

I need to have "Sambalec" :D

Thanks a lot !

Never fear! StringRegEx() is here!
#include <Array.au3>

Global $sString = "i'+'lto:'+qxs+plb+jab+szu+giq+att+'"">'+'test@test.com'+'</a>');" & @CRLF & _
        "</blabla><test> <b>testtest</b></test></td>"
Global $avRET = StringRegExp($sString, "(?:>\'\+\')(.+)(?:\'\+\'<)", 3)
_ArrayDisplay($avRET, "$avRET")


$sString = "blablablabla TEstSambalec" & @CRLF & _
        "bliblibliblibli TEstSambalec" & @CRLF & _
        "tadadadaa TEstSambalec"
$avRET = StringRegExp($sString, "(?:.+\sTEst)(\w+)", 3)
_ArrayDisplay($avRET, "$avRET")

:o


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Authenticity

#include <String.au3>

Dim $sMail = ''
Dim $sVar ="i'+'lto:'+qxs+plb+jab+szu+giq+att+'"">'+'test@test.com'+'</a>');"& _
                  "</blabla><test> <b>testtest</b></test></td>"

$sMail = _StringBetween($sVar, ">'+'", "'+'<")
If IsArray($sMail) Then $sMail = $sMail[0]
ConsoleWrite($sMail & @LF)

Share this post


Link to post
Share on other sites
Exit

#include <string.au3>
$source="""i'+'lto:'+qxs+plb+jab+szu+giq+att+'"">'+'test@test.com'+'</a>');</blabla><test> <b>testtest</b></test></td>"""
$array=_StringBetween($source,">'+'","'+'<")
MsgBox(0, 'E-Mail is',$array[0] )

Edit: just a second too late. :D

Edited by forumer100

My UDFs, Abbrevs and Snippets
If you like my post, just click the like button :) 

Share this post


Link to post
Share on other sites
Authenticity

lol, I see I'm in a good company. ;]

Share this post


Link to post
Share on other sites
sambalec

Many thank's !

All is good.

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  

×