The Cellar  

Go Back   The Cellar > Main > Home Base

Home Base A starting point, and place for threads don't seem to belong anywhere else

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 11-17-2010, 07:00 PM   #11
Happy Monkey
I think this line's mostly filler.
 
Join Date: Jan 2003
Location: DC
Posts: 13,575
I was using unix's regex (I tested using sed).

The ^ is to denote the beginning of the line.
the " *" is to include spaces. If you have tabs as well, you'd need [xy]*, where x is a space and y is a tab.
The [01-9]* catches zero or more digits. I had the leading zero because I wasn't sure whether zero was actually first in ASCII, so I included it separately from the range. It is first, so [0-9]* would work. To make sure you don't get blank lines, it probably should be [1-9][0-9]*. The first brackets are one digit, and the second are zero or more additional digits.
Then another " *" for trailing spaces.
And a \$ for the end of the line. The $ is the symbol, but I need to escape it with the backslash so it doesn't get parsed by my command line.

An updated version could be:
Code:
^[  ]*[1-9][0-9]*[  ]*\$
If the syntax is different in your app, the pattern is:
Code:
(beginning of line marker)[whitespace characters]*[1-9][0-9]*[whitespace characters]*(end of line marker)
__________________
_________________
|...............| We live in the nick of times.
| Len 17, Wid 3 |
|_______________| [pics]
Happy Monkey is offline   Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -5. The time now is 03:06 AM.


Powered by: vBulletin Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.