I need to extract a 7 digit number (6745923) or 7 digit number followed by a (4354678/T) or just a letter: (3546735M)
The below will get the 7 digit numeber but not sure how to get the letters or the forward slash
Sample Text: 1726297T KEVIN GAF RE483948xxxxxxx
(?:^|\D)(\d{7})(?!\d)
ppr
(Peter Preuss)
October 7, 2020, 4:32pm
2
@Automater999
give a try:
\d{7}\/?[A-Za-z]?
Hi,
If i was given the below string it would return “2005739” however i would not expect it to return anything as there is no space after that number. I would like it to only return the string that has a space after it if possible
DRYAD ADUKKAZON FAR AU200573922222
ppr
(Peter Preuss)
October 8, 2020, 11:35am
4
@Automater999
give a try on
\d{7}\/?[A-Za-z]?\
note after last \ there is space within the pattern
Would there be a way of doing a check on both options to see what is returned?
ppr
(Peter Preuss)
October 8, 2020, 1:09pm
6
didnt get you. running both patterns or a combined pattern? But when the first pattern failed, so it will bring again wrong results back.
Let me suggest following: Maybe the first provided samples can be interpretated as values without surrounding () so we can do:
word boundary to begin, optional space on end of pattern
otherwise please provide a clear set of samples representing the variants of your data if a next iteration is needed
Thanks
1 Like
Thank you for the help on this. nearly have it. Its returning everything i want but one exception.
See below. It should not be returning anything here as i want 7 digit numbers only(or with letters and / at the end)
I think i have it with the below. Look correct?
ppr
(Peter Preuss)
October 13, 2020, 5:01pm
9
@Automater999
just trim it after retrieval and then it could work.
With your modification maybe the last \ ?
will become obsolete as an ending space is set as mandatory
How would you suggest trimming after retrieval?
I see what you mean with my suggestion requiring a space after it for it to work…
So the ones i have marked in red are the ones i don’t want to retrieve
ppr
(Peter Preuss)
October 14, 2020, 9:24am
12
@Automater999
just provide a new complete list as text (so we can copy and paste) with samples and the information what should be found and what should be ignored. So we will try to tune the pattern
Here is a sample of items i want to retrieve. in bold
1710838T ROCONN E200106
f 5 1666288/T
1611364T PCOFYRO I245585
fff 1054460T S CREANE I20118
1048782T IE2001061725471
1047233/T TJ OWL IE20013203
JLH 1716917T E20010
47393 3747575
Here is a sample of items i do not want to retrieve. in bold
1400003 201 IE20
BUNP CHQ 7045219 22
UN CHQ 3325141 02
UN CQ 3244378 34
UNP HQ 2175006 25
ppr
(Peter Preuss)
October 14, 2020, 9:34am
14
perfect,thanks
we will have a look on this
1 Like
ppr:
\b\d{7}/?[A-Z]?\b
Looks good. thank you very much
system
(system)
Closed
October 17, 2020, 9:57am
17
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.