Mike Martin wrote:
Hi I am trying to capture only the first occurence of a charcter followed by any word ie: in this sample text !this is a first level heading !!this is a 2nd level heading I only want to find the first item and not the second current code $line=~s/\!(^\![A-Z][a-z].+)/$1/gc; it either doesnt capture any ! or takes out the first ! when there is a double any ideas
Hi Mike. I'm confused as to what you're trying to do, as your regex doesn't make sense and is a subtitution rather than a pattern match. My best guess is that you want to elevate all second-level headings to first- level ones? Maybe something like $line =~ s/^!(![a-z].+)/$1/gi; does what you need. HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/