Avatar of XK8ER
XK8ER
Flag for United States of America asked on

perl split

hello there,
I have a string and I would like to know if its possible to have a split at every char that its not a letter..
how can I do that?
Perl

Avatar of undefined
Last Comment
ozo

8/22/2022 - Mon
ozo

split/\W/
or
split/[^a-zA-Z]/
tel2

split/\W/   # Will also split at digits and "_", of course
split/[^a-zA-Z]/  # Could be written slightly more concisely as:
split/[^a-z]/i

You taught me too well, ozo...I hope
ASKER CERTIFIED SOLUTION
ozo

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ozo

the difference between split/[^a-z]+/i and split/[^a-z]/i
is that when you split at every char that its not a letter,
then multiple non-letters in a row will return the empty strings in between the non-letters
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck