regexrubular

<listRel:entityId>(.*?)<\/listRel:entityId>


Good day.

My work requires me to query and get response from it. I cannot seem to remove the letters or name on this Match group. I need to get just the numbers 917857

I use rubular to check if the match is correct.

917857 James Bond


Solution

  • Here is the Regex to get the number where the number is at the start of the string and is only numbers:

    \<listRel:entityId\>(\d+)[\s\w]+<\/listRel:entityId\>
    

    Here is a working example: Regex101

    This is adjusted to match the additional input example.