Sunday, 15 July 2012

java - Regex for phone number -



java - Regex for phone number -

i can search on every column except number. cannot search number column. because have given regex

rowfilter<mytablemodel, object> rf = null; //if current look doesn't parse, don't update. seek { rf = rowfilter.regexfilter(filtertext.gettext(), 0,1,2,3,4); } grab (java.util.regex.patternsyntaxexception e) { return; } sorter.setrowfilter(rf);

can help me find right regex. current regex not working '+'. if print exception shows

meta character '+' near index 0 (java.util.regex.patternsyntaxexception)

i can search current table columns except number using rowfilter.regexfilter(filtertext.gettext(), 0,1,2,3,4); regex.

firstname lastname number karthy smith +123 john doe +234 sue black +545 jane white +895reading

try

rf = rowfilter.regexfilter(pattern.quote(filtertext.gettext()), 0,1,2,3,4);

as filter.gettext() may (and in case does) contain regex meta characters or escape sequences, lose special meaning using pattern.quote().

java regex jtable

No comments:

Post a Comment