java - regular expression to read a line separated by quotation marks and semicolon -
for example, have 1 line of code:
"12345";"isbn345";"8"
i want write regular expression extract 12345, isbn345, 8.
how write regular expression?
updated:sorry.
i did not make clear. there real data :
"276729";"052165615x";"3"
(my data has many lines , line example). want extract 276729
(user id) 1 element, 052165615x
(book number) one, 3
(book rating) one(that means need match regular expression 3 times per line,so can create 3 objects each time read 1 line) not extract 276729 052165615x 3
@ 1 time
"([^"]+)"(;"([^"]+)")*
[^"]+
match non-empty sequence of non-quote characters. can switch +
*
if strings can empty.
this entire regex 1 quote sequence of not-quotes followed 0 or more quoted sequences separated semicolons.
Comments
Post a Comment