Re: blank lines as "^\s*$"
Sven Guckes <[email protected]>
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <[email protected]> |
* Rakesh Sharma <[email protected]> [2013-07-05 14:15]: > Note: blank line => /^$/ i.e., > one which has no characters, > not even spaces &/or TABs in it. well, a line with *no* characters in it i'd call "empty". so - here's my definition of "blank lines": a "blank line" is contains only "blank characters"; "blank characters" are characters which do not show up with any dots (unless a font gives them any dots). an empty line is a special case of a blank line because all characters contained are "blank". it is certainly valid for every contained element as there are none for which it requires such quality. (okay.. a little bit of set logic here..) you may define a subset of these blank characters to be valid only, eg spaces and tabs. in the editor vim you can use the pattern "\s" for these. (i think the notation of '\s' has been taken from "perl compatible regular expressions" aka PCRE.) so "blank lines" match the pattern "^\s*$" which also matches with empty lines. too bad we dont have "anchors" for "start of data" and "end of data". these would probably make the given problem a breeze. Sven -- $ man 7 regex Standard character class names are: alnum alpha blank cntrl digit graph lower print punct space upper xdigit