DS has asked for the wisdom of the Perl Monks concerning the following question:

Hello guys , I have the following data:
(view: <UUID:50156b3c>) (view: seerla_golden-dev_FGPCfeature) (view: seerla_golden-dev_FGPCfe)
I want to read that file and see if the view contain < > then I need to ignore it so in this case , I want to only get line 2 and 3 and ignore the first one which contains (view: <UUID:50156b3c>) I am doing the following and able to check for the 2 and 3 line but the first is appearing as well and I don't want that.
if(m/\((?:.*): (.*)\)/){$Theview=$1}
thanks for help

Replies are listed 'Best First'.
Re: regex minpulation
by abaxaba (Hermit) on Aug 02, 2002 at 21:42 UTC
    Don't kill an ant with a sledghammer:
    ($Theview) = /([^:]+)\)$/ unless /[<>]/;
    Edit: forgot last ")" in orig. regex

    ÅßÅ×ÅßÅ
    "It is a very mixed blessing to be brought back from the dead." -- Kurt Vonnegut

Re: regex minpulation
by dug (Chaplain) on Aug 02, 2002 at 22:00 UTC
    This seems to do what you want. I opted to split it out into two regexen for simplicity and readability.
    while (<DATA>) { next if m/.*?<.*?>/; #skip if <> exist in view my ($view) = m/\(view: (.*?)\)/; #capture view text print $view, "\n"; } __DATA__ (view: <UUID:50156b3c>) (view: seerla_golden-dev_FGPCfeature) (view: seerla_golden-dev_FGPCfe)
    Hope that helps a bit,
      dug