My macro searching for numbers in different texts. The second picture shows the result. Need the result as pictured 3.
Next step
Open new tab on Chrome past one number and search, next open new tab past second numbers and next …
All the searchable strings of numbers opened in the browser on new tabs picture 4
That's the thing about RegEx: There is usually 1001 ways to write it. LOL
Of course, each author may think his/her solution is best, but "best" is in the eye of the end user.
I think you have a great start, and thanks for putting your solution out there.
My only thought is that it would allow capture of 10 digits of numbers > 10 digits. While the OP stated that he wanted only numbers with 10 digits, he did not stated whether or not the text might contain larger numbers.
So here is another solution that restricts the match to exactly 10 digits:
(?m)(?:^|[^\d])(\d{10})(?:[^\d]|$)
The number you want is in the first capture group.
(Groups that start with "(?:" are non-capture groups.)
EDIT: 2017-09-28 2:59 PM CT
When I tested this with your macro, it failed.
To work, you need to add a _Search Variable_ Action as the first Action in the _For Each_ block:
<img src="/uploads/default/original/2X/c/c7edec65544f078669d4d9a5cd44adabf7eee36f.png" width="424" height="607">
### Example Results
<img src="/uploads/default/original/2X/5/56a1e1de39d8af3b3948b9f1e1d9b0b678957f6c.png" width="351" height="205">
####DOWNLOAD:
<a class="attachment" href="/uploads/default/original/2X/0/0864373d1b5e1f4440b387581b1668ef56f2e0bd.kmmacros">Isolate 10-Digit Numbers @gglick (Rev 1 by @JMichaelTX).kmmacros</a> (7.8 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**
---
<img src="/uploads/default/original/2X/e/e4f052395ee674631f58255358def624ec6f794a.png" width="550" height="1248">
How you navigate between pages is not clear. So here's a general set of steps you can use and modify to fit your needs:
At the end of the current macro, you have the list of numbers in the KM Variable "Local__TestResult". I would probably rename this to something like "Local__NumberList". I'll use that going forward.
Add these steps/actions:
IF %ChromeURL does not contain "www.allegro.pl", then
Open URL "www.allegro.pl"
Pause N seconds until page is loaded. Might be 1 or 2 sec.
Thanks for improving my macro! I didn't build the original to accommodate for numbers with more than 10 digits just because it seemed like for the OP's needs, there would only ever be 10 digit numbers to capture, but of course you're right in that it's better to be precise (especially after I went and named the macro "Isolate 10 Digits" ).
I would like to clarify something for anyone else reading this who may be less familiar with regex, though. When @JMichaelTX said
it initially read to me as if my original macro would capture numbers of more than 10 digits, which confused me for a moment since the {MIN,MAX} pattern would have ensured even in the original that exactly 10 digits would be captured. In order to avoid this confusion for anyone else, let me explain: while the \d{10} pattern I used in my original version will always capture exactly 10 digits, and so will not technically allow numbers with more than 10, the problem that @JMichaelTX fixed is that it would also capture the first 10 digits of any number that was 11 digits or more. In other words, instead of ignoring 11 digit numbers like 85639573057 or 12 digit ones like 308972345543, it would capture the first 10 digits from each, resulting in 8563957305 and 3089723455, respectively. @JMichaelTX's pattern in the improved macro fixes this by ensuring that each sequence of 10 digits is bookended by either the start or end of a line or a non-digit, which causes it to ignore numbers of 11 digits or more.