I have a problem with RegEx in java;
my line is :
CREATE CHAN:NAME=BTSM:1/BTS:2/TRX:5/CHAN:7,CHTYPE=TCHF_HLF,FHSYID=FHSY_0
and I want this :
content [0] = BTSM:1/BTS:2/TRX:5/CHAN:7
content [1] = CHTYPE
content [2] = TCHF_HLF
content [3] = FHSYID
content [4] = FHSY_0
I wrote this :
String[] content = value.split("^=/:|,|=|,$");
but it’s not work 🙁
so kindly inform me about that…
Thanks a lot …
should do what you want.
I don’t understand how you derived
"^=/:|,|=|,$"so I can’t tell you where you went wrong, but here’s a breakdown of what it does.This is going to skip the string
=/:if it occurs at the beginning and stick an empty string at the start of the results. Perhaps you wanted a character set.[=/:]is a character set that matches any occurence of one of those characters.This will split on any comma.
This will split on any equals sign.
This will skip a comma at the end of the input (or just before a newline at the end of input) and if skipped will stick an empty string on the end of the split result.