java - Only capture digits instead of the other text in input for a regex like below -


currently regular expression:

^(?:\\s+\\s+)*?(\\s+)\\s+(?:no\\.\\s+)?(\\s+)(?:\\s+\\(.*?\\))?$ 

captures 418—final in group number 2 input like:

string text="h.b. 418—final version"; 

how change regular expression capture number (digits) of "418" in group2 ? edit:

i'd still capture "h.b." in preceding group.

just change boundaries of second group include digits. save "h.b." part, add paranthesis around part too:

^(?:(\\s+)\\s+)*?(\\d+)\\s+\\s+(?:no\\.\\s+)?(\\s+)(?:\\s+\\(.*?\\))?$ 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -