1) is there some method of string parsing that will ignore what character I use as the delimiter. I.e. if I use a | it will work out of the box without having to escape it.
2) is there a comprehensive set of characters that need to be escaped so that I can check for them?
1) is there some method of string parsing that will ignore what character I use as the delimiter. I.e. if I use a | it will work out of the box without having to escape it.
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
In the example above, the '+' will be the regex meta character "one or more times" and 'myDelimiter' is "quoted".
Originally posted by Henry Wong:
Be careful with using "\\Q" and "\\E" quoting. These do *not* nest. So...
Originally posted by Pat Short:
Thanks for all your helps, really helpful. However, I've run into another issue when I use a tab delimiter "\t" This was working with the previous string.split(del) method. Now with the Pattern.quote it fails and the tab delimiter is not picked up. So I fix problems with | and . but now I break the tab delimiter. Any idea, help greatly appreciated.
Thanks
Originally posted by Pat Short:
Yes and no!
Originally posted by Pat Short:
...
where args[0] is \t passed in from the command line
...
The government thinks you are too stupid to make your own lightbulb choices. But this tiny ad thinks you are smart:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|