Jump to content
Sign in to follow this  
youtuber

StringRegExpReplace question in a complex structure?

Recommended Posts

Left and right part I want to not delete

Left : "asdf":{"asdf_blabla":"

Right : ","asdf_blabla"

$s = '"asdf":{"asdf_blabla":"The part I want to replace","asdf_blabla"'

Msgbox(0,"", StringRegExpReplace($s, '"asdf":{"asdf_blabla":"(.*?)","asdf_blabla"', 'add something to the part you want to change'))

 

Share this post


Link to post
Share on other sites

@mikell Now I understand better :) $1 $2 $3 👍 Thank you

Also I would like to add it from a variable but removing slash marks cause?

$aDir = @ScriptDir & "\myfolder"
$s = '"asdf":{"asdf_blabla":"The part I want to replace","asdf_blabla"'
ConsoleWrite(StringRegExpReplace($s, '("asdf":{"asdf_blabla":")(.*?)(","asdf_blabla")', '$1' & $aDir & '$3') & @CRLF)

"asdf":{"asdf_blabla":"C:UsersUSERDesktopmyfolder","asdf_blabla"

Edited by youtuber

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...