Jump to content

StringRegExpReplace


Recommended Posts

is that correct? or how to correct it?

StringRegExpReplace($HostText, '[.(0-9)\t]' & 'Server', $NewIP)

'[.(0-9)\t]' & 'Server' represent an IP Address followed by a tab then the name of the machine,

$NewIP contains the replacement text.

Link to comment
Share on other sites

$HostText = 'some text 192.168.20.48' & @TAB & 'Server'
$NewIP = '10.10.10.25'
ConsoleWrite($HostText & @CRLF)

$HostText = StringRegExpReplace($HostText, '([0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3})\tServer', $NewIP & @TAB & 'Server')
ConsoleWrite($HostText & @CRLF)

Edited by Zedna
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...