Regex expression help

hi all.....

i try to mod ify my .ini file using regex function......and this is my code

Dim checkpassword As String = Regex.Replace(Regex.Replace(line, "^USER=goh.dev.ss.lan", ""), "Password=", "Password=123")

sw.WriteLine(checkpassword)
sw.Close()

this will replace all the matched password.........but i only wanna replace the 1st line which match this condition.....how can i do this ?

or there is another ways in solving this problem...

thanks

(Moderator: Thread moved to the Regular Expression Forum and Title tweaked for quicker thread understanding during a search)
[800 byte] By [goh6613] at [2008-2-6]
# 1

Check the count parameter.

Visual Basic (Declaration)
Public Function Replace ( _

input As String, _

replacement As String, _

count As Integer, _

startat As Integer _

) As String

Visual Basic (Usage)
Dim instance As Regex

Dim input As String

Dim replacement As String

Dim count As Integer

Dim startat As Integer

Dim returnValue As String

returnValue = instance.Replace(input, replacement, count, startat)

Parameters

input

The string to modify.

replacement

The replacement string.

count

Maximum number of times the replacement can occur.

startat

The character position in the input string where the search will begin.

Return Value

The modified character string.

TallDude at 2007-8-30 > top of Msdn Tech,.NET Development,Regular Expressions...
# 2

Hi goh6613,

If you feel the issue is resolved to your liking...mark the post that helped you as the answer, so when others search the forums, they might be more inclined to look at a successful post than a non successful one...in the search results the Answered posts are bubbled to the top before the unanswered.

Or post if you need more help!

Thanks

OmegaMan at 2007-8-30 > top of Msdn Tech,.NET Development,Regular Expressions...

.NET Development

Site Classified