Like Jeff said, you can just use \w if you are allowing numbers as well.
> s/([A-Za-z]_*)/\n$1/g;
This will take a little bit of explaining, so bear with me.
[ ... ] - Brackets represent a "character class". A char class will match a
SINGLE char that is inside of it. So if I wanted to match "a", "b", or "c"
I would use [abc]. As a shortcut you can use a "range" to specify a list of
chars. A range line "a-k" is the same as "abcdefghijk". Ranges are just a
shortcut, and you can use ranges along with single chars in the char class.
So I could match a single char that is in the range "a-k" or is a "z" by
using [a-kz].
Your mistake was that you placed the underscore ("_") outside of the range,
not inside it.
This is what you meant to do:
s/([A-Za-z_]*)/\n$1/g;
Hope that helps.
Rob
-----Original Message-----
From: Trina Espinoza [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 09, 2003 4:11 PM
To: [EMAIL PROTECTED]
Subject: Regular Expression question
How do you create a regular expression that allows you to have files like
ths:
Stuff_Dev
Greg_Files
myThings_
_default
I wrote this
s/([A-Za-z]*)/\n$1/g;
It only gets the letters, but I am not sure how to write in the underscore.
Any attemps I have made
on adding the _ get the wrong results e.g -->s/([A-Za-z]_*)/\n$1/g;
<---Didn't work.Created a newline
right before the underscore.
Assistance would be much appreciated :)
-T
_________________________________________________________________
Get McAfee virus scanning and cleaning of incoming attachments. Get Hotmail
Extra Storage! http://join.msn.com/?PAGE=features/es
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]