Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TCL regexp: Problem with Non Greedy search 1

Status
Not open for further replies.

tclcool

Programmer
Apr 22, 2007
2
US
Hi,

I'm facing problem using a non greedy search. Consider the following
example
% set data "Facing problem with non greedy search"
Facing problem with non greedy search
% regexp -nocase {(.*?g)(.*)} $data junk match1 match2
1
% set match1
Facing
% set match2
%

As expected value set in match1 is 'Facing'
But match2 is set to empty string whereas I was expecting it to be set
to ' problem with non greedy search'.

Can anybody explain this.
 
Thanks a lot Feherke :)
Since sometime I was looking solution for the above problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top