Lines with only white space.

View: New views
14 Messages — Rating Filter:   Alert me  

Lines with only white space.

by Ian Skinner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What would a regex expression to find lines with any type and amount of white space characters but nothing else look like?


--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
 
"C code. C code run. Run code run. Please!"
- Cynthia Dunning

Confidentiality Notice:  This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:905
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Lines with only white space.

by Jerry Johnson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

"(^|[[:cntrl:]])[[:blank:]]+([[:cntrl:]]|$)"

Maybe?


On 8/11/05, Ian Skinner <ian.skinner@...> wrote:
> What would a regex expression to find lines with any type and amount of white space characters but nothing else look like?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:906
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Lines with only white space.

by Adrian Lynch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

^\s*?$

^ start of a line
\s whitespace
*? zero or more times
$ end of line

Which is a quick guess.

Ade

-----Original Message-----
From: Ian Skinner [mailto:ian.skinner@...]
Sent: 11 August 2005 20:48
To: RegEx
Subject: Lines with only white space.


What would a regex expression to find lines with any type and amount of
white space characters but nothing else look like?


--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA

"C code. C code run. Run code run. Please!"
- Cynthia Dunning

Confidentiality Notice:  This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:907
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Parent Message unknown RE: Lines with only white space.

by Ian Skinner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nope did not work.  I've been trying variations of ^\s*$ but with no success.  Interesting even a simple ^\s* did not match anything.  Only thing I can get to work at all is \s*, but this matches any white space in any line and even across lines and I just want the line with all white space.


--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
 
"C code. C code run. Run code run. Please!"
- Cynthia Dunning

Confidentiality Notice:  This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:908
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Parent Message unknown RE: Lines with only white space.

by Ian Skinner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nope matched nothing.


--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
 
"C code. C code run. Run code run. Please!"
- Cynthia Dunning

Confidentiality Notice:  This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:909
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Lines with only white space.

by Ben Doom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Depending on your line breaks and whatnot....

linebreak = chr(10);

lines = refind(string, "(^|#linebreak#)\s*(#linebreak#|$)", 1);

My syntax on refind may be off -- I can never keep it straight for some
reason.

--Ben

Ian Skinner wrote:

> What would a regex expression to find lines with any type and amount of white space characters but nothing else look like?
>
>
> --------------
> Ian Skinner
> Web Programmer
> BloodSource
> www.BloodSource.org
> Sacramento, CA
>  
> "C code. C code run. Run code run. Please!"
> - Cynthia Dunning
>
> Confidentiality Notice:  This message including any
> attachments is for the sole use of the intended
> recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the
> intended recipient, please contact the sender and
> delete any copies of this message.
>
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:911
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Lines with only white space.

by Adrian Lynch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Could we see how you're testing this?

-----Original Message-----
From: Ian Skinner [mailto:ian.skinner@...]
Sent: 11 August 2005 21:01
To: RegEx
Subject: RE: Lines with only white space.


Nope did not work.  I've been trying variations of ^\s*$ but with no
success.  Interesting even a simple ^\s* did not match anything.  Only thing
I can get to work at all is \s*, but this matches any white space in any
line and even across lines and I just want the line with all white space.


--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA

"C code. C code run. Run code run. Please!"
- Cynthia Dunning

Confidentiality Notice:  This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:910
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Parent Message unknown RE: Lines with only white space.

by Ian Skinner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm just using the DW find and replace with regular expression feature to search a text file.


--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
 
"C code. C code run. Run code run. Please!"
- Cynthia Dunning

Confidentiality Notice:  This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:912
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Parent Message unknown RE: Lines with only white space.

by Ian Skinner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Since I'm using this in DW's Find and replace I converted your code to this "\n\s+\n".  This is the closet yet, but I do not want to match the first new line I just want the blank line and this return the end of the previous line and the blank line.  But if  I remove the first \n, I start matching the end of every line, and I don't want that either, just the blank lines.


--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
 
"C code. C code run. Run code run. Please!"
- Cynthia Dunning

Confidentiality Notice:  This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:913
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Lines with only white space.

by Jerry Johnson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Not fair. My answer assumed you were using COLDFUSION. (And it works
in there, I just tested it.)
I'll look at homesite/dreamweaver now.

On 8/11/05, Ian Skinner <ian.skinner@...> wrote:

> I'm just using the DW find and replace with regular expression feature to search a text file.
>
>
> --------------
> Ian Skinner
> Web Programmer
> BloodSource
> www.BloodSource.org
> Sacramento, CA
>
> "C code. C code run. Run code run. Please!"
> - Cynthia Dunning
>
> Confidentiality Notice:  This message including any
> attachments is for the sole use of the intended
> recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the
> intended recipient, please contact the sender and
> delete any copies of this message.
>
>
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:914
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Lines with only white space.

by Ben Doom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Replace with a newline.  That should kill the extra lines.

Ian Skinner wrote:

> Since I'm using this in DW's Find and replace I converted your code to this "\n\s+\n".  This is the closet yet, but I do not want to match the first new line I just want the blank line and this return the end of the previous line and the blank line.  But if  I remove the first \n, I start matching the end of every line, and I don't want that either, just the blank lines.
>
>
> --------------
> Ian Skinner
> Web Programmer
> BloodSource
> www.BloodSource.org
> Sacramento, CA
>  
> "C code. C code run. Run code run. Please!"
> - Cynthia Dunning
>
> Confidentiality Notice:  This message including any
> attachments is for the sole use of the intended
> recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the
> intended recipient, please contact the sender and
> delete any copies of this message.
>
>
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:915
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Parent Message unknown RE: Lines with only white space.

by Ian Skinner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

\s+\r\n

This seems to be almost there, but it is greedy. It will take multiple lines if there is nothing on them.  Is there someway to make it stop at the first /r/n it finds after 1 or more white space characters?


--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA
 
"C code. C code run. Run code run. Please!"
- Cynthia Dunning

Confidentiality Notice:  This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message.




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:916
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Lines with only white space.

by Tony Hicks :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have the same problem with REFind

From livedocs
REFind(reg_expression, string [, start ]   [, returnsubexpressions ] )
(and comparatively, Find(substring, string [, start ]))

Seems like every other string function takes the string parameter
first.. Replace, ReRep, Left, Right, Mid, Encrypt, Decrypt,
ListValueCount, RepeatString, ReplaceList, and of course all the
functions that have NoCase companions).

ListFind even takes the "string" to be searched as the first
parameter, as does ValueList.

But Find and Refind take the string to search for, first.

How very... odd.

On 8/11/05, Ben Doom <bdoom-hof@...> wrote:

> Depending on your line breaks and whatnot....
>
> linebreak = chr(10);
>
> lines = refind(string, "(^|#linebreak#)\s*(#linebreak#|$)", 1);
>
> My syntax on refind may be off -- I can never keep it straight for some
> reason.
>
> --Ben
>
> Ian Skinner wrote:
> > What would a regex expression to find lines with any type and amount of white space characters but nothing else look like?
> >
> >
> > --------------
> > Ian Skinner
> > Web Programmer
> > BloodSource
> > www.BloodSource.org
> > Sacramento, CA
> >
> > "C code. C code run. Run code run. Please!"
> > - Cynthia Dunning
> >
> > Confidentiality Notice:  This message including any
> > attachments is for the sole use of the intended
> > recipient(s) and may contain confidential and privileged
> > information. Any unauthorized review, use, disclosure or
> > distribution is prohibited. If you are not the
> > intended recipient, please contact the sender and
> > delete any copies of this message.
> >
> >
> >
> >
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:917
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Lines with only white space.

by Tony Hicks :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Er, not ValueList, but ListValueCount.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:21:918
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/21
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:21
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.21
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54