android - Regular Expression failed when I try to get all files that name only contains number -


i try list files under "/proc" on android device,and files' names contain numbers,such '123','435'.i try filter regular expression.i tried 3 expressions below of these failed sometimes:

^[0-9]+$  [0-9]+   \d+ 

i wonder how can 3 expressions can match such "14971" can't match "15003"?

i think boober bunz right, file extension difference. 3 of expressions match both "14971" , "15003"

the best way pull extensions off filenames, , use restrictive expression need to: ^[0-9]+$

or if want leave extension on, work you:

"^[0-9]+[.][^.]*$"

start of string, 1 or more digits, must have . , number of non . end of string. not match:

"123.123.txt"


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -