Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regex as third argument of split?

Status
Not open for further replies.

Cornelius19

Technical User
Mar 9, 2007
26
Hello,

The following line works fine in my script:

split(t, words, " ");

It splits/divides the string ‘t’ (actually a text) into words and puts them into a table called ‘words’. I would like to change the separator from space to (space AND question mark AND exclamation mark). I guess the best is to use a regex and tried the following:

split(t, words, [ !?]);

However, I received an error message saying that “0 is invalid as number of arguments for split”. Any idea to fix this issue?

Thanks,

Cornelius
 
And this ?
split(t, words, /[ !?]/)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top