Sign in to follow this  
Followers 0
ffdshow

Replace string in registry value

3 posts in this topic

Hi,

I have a large registry value that contain the next string:

<audioSettings><deviceId>Realtek Digital Input (Realtek </deviceId>

The string "Realtek Digital Input (Realtek" can be "Microphone (SB Audigy)" or else.

I want to change "Realtek Digital Input (Realtek" or whatever is between <audioSettings><deviceId>  and </deviceId> with "NO_MIC", to look finally like this:

<audioSettings><deviceId>NO_MIC</deviceId>

How should look the StringRegExpReplace command?

Share this post


Link to post
Share on other sites



$str = "<audioSettings><deviceId>Realtek Digital Input (Realtek </deviceId>"

Msgbox(0,"", StringRegExpReplace($str, '(?<=<deviceId>)([^<]+)', "NO_MIC") )

:)

1 person likes this

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks!

The script should look like this:

$string = RegRead("HKEY_CURRENT_USER\Software\TechSmith\Camtasia Studio\8.0\Camtasia Recorder\8.0", "RecorderConfig")
$replace = "NO_MIC"
$new_string = StringRegExpReplace($string, '(?<=<deviceId>)([^<]+)', $replace)
RegWrite("HKEY_CURRENT_USER\Software\TechSmith\Camtasia Studio\8.0\Camtasia Recorder\8.0", "RecorderConfig", "REG_SZ", $new_string)
Edited by ffdshow

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