C
cbongior
String testText = "\"christian bongiorno\" AND Joe OR \"Electrical,
plumbing\"";
I would like to parse the above text into it's 'components' in an easy
and preferrably native java library fashion. I mean, I can implement a
custom parse, but it would be a little ugly.
Ultimately, I would like the following tokens:
1) Christian bongiorno
2) AND
3) Joe
4) OR
5) Electrical, plumbing
With StringTokenizer I can correctly get the quoted words, but it
doesn't distingush the non-quoted. So, I get
StringTokenizer tokens = new StringTokenizer("\"christian bongiorno\"
AND Joe OR \"Electrical, plumbing\"","\"");
produces
1) Christian bongiorno
2) AND Joe OR
3) Electrical, plumbing
As you guessed, this is for text searching. Also, No 3rd party
libraries. But be all core Java
ideas?
plumbing\"";
I would like to parse the above text into it's 'components' in an easy
and preferrably native java library fashion. I mean, I can implement a
custom parse, but it would be a little ugly.
Ultimately, I would like the following tokens:
1) Christian bongiorno
2) AND
3) Joe
4) OR
5) Electrical, plumbing
With StringTokenizer I can correctly get the quoted words, but it
doesn't distingush the non-quoted. So, I get
StringTokenizer tokens = new StringTokenizer("\"christian bongiorno\"
AND Joe OR \"Electrical, plumbing\"","\"");
produces
1) Christian bongiorno
2) AND Joe OR
3) Electrical, plumbing
As you guessed, this is for text searching. Also, No 3rd party
libraries. But be all core Java
ideas?