Using regex to split a line from a file

(imported topic written by SystemAdmin)

Hi,

I’m trying to parenthesize lines of a file using the following relevance:-

(parenthesized part 1 of it, parenthesized part 5 of it) of matches (regex “(.+):(.+):(.+):(.+):(.+):(.+):(.+)” ) of (lines of file “passwd” of folder “D:\Bigfix_Testing_area\etc”)

The file “passwd” contains the following:-

u686689:x:686689:10:Donald Duck:/home/u686689:/usr/bin/ksh

u870235:x:870235:10:Mickey Mouse:/home/u870235:/usr/bin/ksh

The result I was hoping to achieve was:-

u686689, Donald Duck

u870235, Mickey Mouse

What I ended up with was:-

u686689, Donald Duck

686689, Donald Duck

86689, Donald Duck

6689, Donald Duck

689, Donald Duck

89, Donald Duck

9, Donald Duck

u870235, Mickey Mouse

870235, Mickey Mouse

70235, Mickey Mouse

0235, Mickey Mouse

235, Mickey Mouse

35, Mickey Mouse

5, Mickey Mouse

I can see what the problem is but I’m stuck (and have been for the last two days) as to how to prevent it!

As you can probably see - my regex knowledge leans more towards the “0% of almost nothing”!! :-s

Can anyone see where I’m going wrong - or is there a better way to split an input line at a given character.

Thanks for any help.

Mark

(imported comment written by SystemAdmin)

Sorry to bother you folks - I eventually cracked it by trawling through other fixlets, etc. The answer was to add a “^” and a “$” to either end of the regex. As in…

(parenthesized part 1 of it, parenthesized part 5 of it) of matches (regex "

color=blue

^/color:(.+):(.+):(.+):(.+):(.+):(.+)

color=blue

$[/color]" ) of (lines of file “passwd” of folder “D:\Bigfix_Testing_area\etc”)

Cheers,

Mark.