Sign in to follow this  
Followers 0
jimmy999

insert somthing after string

7 posts in this topic

#1 ·  Posted (edited)

hi , ai have this

$string = ("1234=5678=9999=xxxx")

$var = ("somthing")

i whant to add after first equal ("somthing") , after continue my work

after i whant to add after second equal ("somthing") , after continue my work

etc for all equals

and one line if ("somthing") contains special characters do not give me error

work with file split $String = StringSplit( ("1234=5678=9999=xxxx"), "=") but the result is 1234, 5678, etc, i whant to be 1234=$var ,1234=5678=$var , 1234=5678=9999=$var

tnx

Edited by jimmy999

Share this post


Link to post
Share on other sites



Can you post an example which is not confusing?

In: "1234=5678=9999=xxxx"

Out: ?

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Can you post an example which is not confusing?

In: "1234=5678=9999=xxxx"

Out: ?

Br,

UEZ

$string = ("http://search.avira.com/?l=dis&o=APN10401&gct=hp&dc=EU&locale=")

it's about url adress

for example

$var1 = ("xxx")

$var2 = ("zzz")

$var3 = ("ddd")

$oIE.navigate ("http://search.avira.com/?l=xxxdis&o=APN10401&gct=hp&dc=EU&locale=")

$oIE.navigate ("http://search.avira.com/?l=zzzdis&o=APN10401&gct=hp&dc=EU&locale=")

$oIE.navigate("http://search.avira.com/?l=ddddis&o=APN10401&gct=hp&dc=EU&locale=")

after

$oIE.navigate ("http://search.avira.com/?l=dis&o=xxxAPN10401&gct=hp&dc=EU&locale=")

$oIE.navigate ("http://search.avira.com/?l=dis&o=zzzAPN10401&gct=hp&dc=EU&locale=")

$oIE.navigate ("http://search.avira.com/?l=dis&o=dddAPN10401&gct=hp&dc=EU&locale=")

etc for any equal

Edited by jimmy999

Share this post


Link to post
Share on other sites

Something like that here?

$string = "http://search.avira.com/?l=dis&o=APN10401&gct=hp&dc=EU&locale="

$var1 = "xxx"
$var2 = "yyy"
$var3 = "zzz"

ConsoleWrite(StringRegExpReplace($string, "(.*l=)(.*)(dis.*)", "$1" & $var1 & "$3") & @CRLF)
ConsoleWrite(StringRegExpReplace($string, "(.*l=)(.*)(dis.*)", "$1" & $var2 & "$3") & @CRLF)
ConsoleWrite(StringRegExpReplace($string, "(.*l=)(.*)(dis.*)", "$1" & $var3 & "$3") & @CRLF & @CRLF)

ConsoleWrite(StringRegExpReplace($string, "(.*&o=)(.*)(APN.*)", "$1" & $var1 & "$3") & @CRLF)
ConsoleWrite(StringRegExpReplace($string, "(.*&o=)(.*)(APN.*)", "$1" & $var2 & "$3") & @CRLF)
ConsoleWrite(StringRegExpReplace($string, "(.*&o=)(.*)(APN.*)", "$1" & $var3 & "$3") & @CRLF)

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

Something like that here?

$string = "http://search.avira.com/?l=dis&o=APN10401&gct=hp&dc=EU&locale="

$var1 = "xxx"
$var2 = "yyy"
$var3 = "zzz"

ConsoleWrite(StringRegExpReplace($string, "(.*l=)(.*)(dis.*)", "$1" & $var1 & "$3") & @CRLF)
ConsoleWrite(StringRegExpReplace($string, "(.*l=)(.*)(dis.*)", "$1" & $var2 & "$3") & @CRLF)
ConsoleWrite(StringRegExpReplace($string, "(.*l=)(.*)(dis.*)", "$1" & $var3 & "$3") & @CRLF & @CRLF)

ConsoleWrite(StringRegExpReplace($string, "(.*\&o\=)(.*)(APN.*)", "$1" & $var1 & "$3") & @CRLF)
ConsoleWrite(StringRegExpReplace($string, "(.*\&o\=)(.*)(APN.*)", "$1" & $var2 & "$3") & @CRLF)
ConsoleWrite(StringRegExpReplace($string, "(.*\&o\=)(.*)(APN.*)", "$1" & $var3 & "$3") & @CRLF)

Br,

UEZ

somthing like this but the url is variable,

$string =("http://websit.com/bla=bla=xxx=zzz=")

i need also with array i think

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

bump,

plz helpme, im beginner and this with StringRegExpReplace is hard for me...

for example: $string = ("http://search.avira.com/?l=dis&o=APN10401&gct=hp&dc=EU&locale=")

my var = "test"

in firs case i need to replace the red word with my variable, like this "http://search.avira.com/?l=test&o=test&gct=test&dc=test&locale="

in the second case i need to replace the red text one by one

my var1 = "aaa"

my var2 = "bbb"

my var3 = "ccc"

like this

("http://search.avira.com/?l=aaa&o=APN10401&gct=hp&dc=EU&locale=")

("http://search.avira.com/?l=bbb&o=APN10401&gct=hp&dc=EU&locale=")

("http://search.avira.com/?l=ccc&o=APN10401&gct=hp&dc=EU&locale=")

after first equal is done pass to second equal

("http://search.avira.com/?l=dis&o=aaa&gct=hp&dc=EU&locale=")

("http://search.avira.com/?l=dis&o=bbb&gct=hp&dc=EU&locale=")

("http://search.avira.com/?l=dis&o=ccc&gct=hp&dc=EU&locale=")

and and so with all equals..

i think with array and strigregexpreplace is good.

the variable need to be between = and & , like this =aaa&

sorry for my bad english...tnx in advance

ps: $string is variable

Edited by jimmy999

Share this post


Link to post
Share on other sites

And what about this?

$string = "http://search.avira.com/?l=dis&o=APN10401&gct=hp&dc=EU&locale="

;first
$var = "test"
ConsoleWrite(StringRegExpReplace($string, "(.*l=)(.+)(&.*o=)(.+)(&gct=)(.+)(&dc=)(.+)(&.*)", "$1" & $var & "$3" & $var & "$5" & $var & "$7" & $var & "$9") & @CRLF & @CRLF)


;second
$var1 = "xxx"
$var2 = "yyy"
$var3 = "zzz"

ConsoleWrite(StringRegExpReplace($string, "(.*l=)(.*)(dis.*)", "$1" & $var1 & "$3") & @CRLF)
ConsoleWrite(StringRegExpReplace($string, "(.*l=)(.*)(dis.*)", "$1" & $var2 & "$3") & @CRLF)
ConsoleWrite(StringRegExpReplace($string, "(.*l=)(.*)(dis.*)", "$1" & $var3 & "$3") & @CRLF & @CRLF)

ConsoleWrite(StringRegExpReplace($string, "(.*&o=)(.*)(APN.*)", "$1" & $var1 & "$3") & @CRLF)
ConsoleWrite(StringRegExpReplace($string, "(.*&o=)(.*)(APN.*)", "$1" & $var2 & "$3") & @CRLF)
ConsoleWrite(StringRegExpReplace($string, "(.*&o=)(.*)(APN.*)", "$1" & $var3 & "$3") & @CRLF & @CRLF)

ConsoleWrite(StringRegExpReplace($string, "(.*gct=)(.*)(&dc.*)", "$1" & $var1 & "$3") & @CRLF)
ConsoleWrite(StringRegExpReplace($string, "(.*gct=)(.*)(&dc.*)", "$1" & $var2 & "$3") & @CRLF)
ConsoleWrite(StringRegExpReplace($string, "(.*gct=)(.*)(&dc.*)", "$1" & $var3 & "$3") & @CRLF & @CRLF)

ConsoleWrite(StringRegExpReplace($string, "(.*dc=)(.*)(&loc.*)", "$1" & $var1 & "$3") & @CRLF)
ConsoleWrite(StringRegExpReplace($string, "(.*dc=)(.*)(&loc.*)", "$1" & $var2 & "$3") & @CRLF)
ConsoleWrite(StringRegExpReplace($string, "(.*dc=)(.*)(&loc.*)", "$1" & $var3 & "$3") & @CRLF)

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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