BuddyJoe
BuddyJoe

Reputation: 71101

grep / regex - single comma on a line

How would you grep through a set of files looking for any file that has a comma on a line by itself with this caveat. I want it to test true if the comma has whitespace characters before or after it.

Upvotes: 0

Views: 2800

Answers (1)

CanSpice
CanSpice

Reputation: 35790

The regex for a single comma character on a line, surrounded by optional whitespace is:

/^\s*,\s*$/

Upvotes: 1

Related Questions