3

Possible Duplicate:
Match whitespace but not newlines (Perl)

I need to search for an expression, using Perl style regex, in every line that matches certain pattern surrounded by an arbitrary amount of space, tab, ff, etc (i.e. whitespace) characters. But I want to limit this to 1 single line. My own program logic would advance to the next line. If I use [\s]* in my regex, it always matches the newline. This is annoying.

Is there anyway to force \s to exclude newline (\n and \r)? I want my code to be usable in ANSI and UNICODE file so I want to keep using standard meta characters as much as possible rather than listing all possible whitespace candidates (unicode has some addition characters counted as whitespace and I don't want to know the details. \s should cater for this automatically except it also matches newline).

Community
  • 1
  • 1
JavaMan
  • 4,954
  • 4
  • 41
  • 69

0 Answers0