Android Question Parsing Help

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I need to replace any form of " bk### " with " ### "

bk can be lower case or upper case

### is a number 1 to 3 digits

Examples: " bk123 " would become " 123 "

NOW there is a lot of other text and numbers in this string.
But I need an easy way to convert this particular case and everything becomes easy.

Is there a Regex expression that would do this for me?

Thanks

BobVal
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
I am not familiar with Regex but searching a bit I came up with this
B4X:
Sub find_expression(text As String)
    Dim matchr As Matcher=Regex.Matcher("\bbk[0-9]{1,3}\b",text )
   
    Do While matchr.Find
        Dim result As String =matchr.Match
        Log(result.SubString(2))
    Loop
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…