Doubt with REGEX, I can't find the correct pattern

Hello, I need to find the regex to locate the following data 01597532R, thanks for the help

NIF. B00000000 9541
EMPRESA DOMICILIO Nº INS. S.S.
tu empresa , S.L. CL 00/0049547-23
TRABAJADOR/A CATEGORIA NºMATRIC ANTIGUEDAD D.N.I.
APELLIDO APELLIDO, NOMBRE ESPECIALIA 16 SEP 23 01597532R
Nº AFILIACION. S.S. TARIFA COD.CT SECCION NRO. PERIODO TOT. DIAS
41/74859679-94 9 258 254 MENS 01 ENE 22 a 31 ENE 22 31
CUANTIA PRECIO CONCEPTO DEVENGOS DEDUCCIONES

Regex is about patterns. And in Patterns we can try to make them more solid, when some reliable structure details can be added.

Without any other info we can try:

have a look below and check for the SOP, which is about to give us more details for a better support

and also:

Thank you, that worked for me, but I have found another case, it can be sometimes that record starts and ends with a letter, how would the regular expression be for both X0000000V and 000000000V

Thank you, that worked for me, but I have found another case, it can be sometimes that record starts and ends with a letter, how would the regular expression be for both X0000000V and 000000000V

It worked for me like this [A-Z]\d+[A-Z]|\d+[A-Z]

Hi @RPASOFT

You can try this pattern also

User assign activity

LHS → Create an variable
RHS → System.Text.RegularExpressions.Regex.Match(“Input string”,“[A-Za-z]\d+[A-Za-z]|\d{2}\d+[A-Za-z]”).Tostring

Regards
Gokul