RPASOFT
(RPASOFT)
February 10, 2022, 5:51pm
1
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
ppr
(Peter Preuss)
February 10, 2022, 7:01pm
2
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:
This CheatSheet introduces the basic use of regex functions. With further examples also special cases are presented.
Introduction
From the namespace System.Text.RegularExpressions following methods are offered:
Regex.Match
Regex.Matches
Regex.isMatch
Regex.Replace
Regex.Split
A simple usage for example would look like this:
[grafik]
Recommendation:
add System.Text.RegularExpressions to the imports:
[grafik]
it allows to use the shortened statement, as the namespace part can be ommited…
RPASOFT
(RPASOFT)
February 11, 2022, 6:52am
3
RPASOFT:
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
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
RPASOFT
(RPASOFT)
February 11, 2022, 6:53am
4
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
RPASOFT
(RPASOFT)
February 11, 2022, 6:58am
5
It worked for me like this [A-Z]\d+[A-Z]|\d+[A-Z]
Gokul001
(Gokul Balaji)
February 11, 2022, 7:25am
6
Hi @RPASOFT
RPASOFT:
[A-Z]\d+[A-Z]|\d+[A-Z]
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