You are here: PSPad forum > English discussion forum > Regex issue (percentages)

Regex issue (percentages)

Goto Page: Previous1 2 3 Next

#11 Re: Regex issue (percentages)

Posted by: maki | Date: 06/29/2018 08:06 | IP: IP Logged

All regex not work !!!

---------------------------
Info
---------------------------
Next occurrence of "[^\d\.]\d{1,2}(\.\d%|%)" not found.
---------------------------
OK
---------------------------

Options: Reply | Quote | Up ^


#12 Re: Regex issue (percentages)

Posted by: pspad | Date: 06/29/2018 08:24 | IP: IP Logged

You have square brackets in first part, why? Maybe it's time to read something about regular expressions.

Use this:
\s\d{1,2}(\.\d{1,2}%|%)

Edited 1 time(s). Last edit at 06/29/2018 08:26 by pspad.

Options: Reply | Quote | Up ^


#13 Re: Regex issue (percentages)

Posted by: maki | Date: 06/29/2018 14:48 | IP: IP Logged

image

Options: Reply | Quote | Up ^


#14 Re: Regex issue (percentages)

Posted by: vbr | Date: 06/29/2018 15:48 | IP: IP Logged

Hi,
the regex search fails as expected on the given text
the starting part:
[^\d\.]
requires exactly one character other than a digit or a dot, which are not there at the given positions.
Using regex search for this might be rather demanding to get right;

if your log data for downloads are always on single line and you want to filter lines for incomplete downloads, it might be possible without regex in pspad.

in the Find dialog (Ctrl+F) use the pattern
100%
check [x] Copy non-matching
and click [Copy]

The resulting lines (other than those containing 100%) are then copied to a new file.
If there are other irrelevant lines in your data file, you can list only those containing "%"
again, use % in the search field,
uncheck [x] Copy non-matching
and click [Copy].

hth,
vbr

Edited 1 time(s). Last edit at 06/29/2018 15:49 by vbr.

Options: Reply | Quote | Up ^


#15 Re: Regex issue (percentages)

Posted by: aGerman | Date: 06/29/2018 16:31 | IP: IP Logged

The lines in #6 clearly show the percentages at the end of the line. Now the requirements changed and as Jan already said also the beginning of a line has to be matched as alternative and using OR in case the percentage is at the beginning of the line.
(^|[^\.\d])\d{1,2}(\.\d%|%)
image

Steffen

Options: Reply | Quote | Up ^


#16 Re: Regex issue (percentages)

Posted by: pspad | Date: 06/29/2018 17:26 | IP: IP Logged

maki:

I provided you working expression for your purposes in my latest answer.
You have no intention to learn, you have no intention to read answers.

Edited 1 time(s). Last edit at 06/29/2018 17:27 by pspad.

Options: Reply | Quote | Up ^


#17 Re: Regex issue (percentages)

Posted by: Andreas | Date: 06/30/2018 11:14 | IP: IP Logged

@maki

First try on this page before asking: regex101.com
^\d*\.?\d*%

Options: Reply | Quote | Up ^


#18 Re: Regex issue (percentages)

Posted by: maki | Date: 07/05/2018 13:08 | IP: IP Logged

I tested and found only percentages, not the full name with percentages. Regex can be compliced for 10000000 of different path... so it does not work correctly.

Options: Reply | Quote | Up ^


#19 Re: Regex issue (percentages)

Posted by: aGerman | Date: 07/05/2018 18:04 | IP: IP Logged

maki:
Regex can be compliced for 10000000 of different path...

No, that's exactly what Regex is made for. You just have to specify the rules and that's it. The right pattern will work for 10 lines as good as for 10000000 lines.

(^|(^.*[^\.\d]+))\d{1,2}(\.\d%|%)

Steffen

Options: Reply | Quote | Up ^


#20 Re: Regex issue (percentages)

Posted by: maki | Date: 07/06/2018 09:53 | IP: IP Logged

aGerman:
maki:
Regex can be compliced for 10000000 of different path...

No, that's exactly what Regex is made for. You just have to specify the rules and that's it. The right pattern will work for 10 lines as good as for 10000000 lines.

(^|(^.*[^\.\d]+))\d{1,2}(\.\d%|%)

Steffen

Work smiling smiley

R:\Gym\-5076373\-13974757_348284311.jpg -> I:\Gym\-5076373\-13974757_348284311.jpg - Kopiowanie zakończone powodzeniem 100%

R:\Gym\-5076373\-13974757_392683937.jpg -> I:\Gym\-5076373\-13974757_392683937.jpg - Kopiowanie zakończone powodzeniem 99.9%

Options: Reply | Quote | Up ^


Goto Page: Previous1 2 3 Next





Editor PSPad - freeware editor, © 2001 - 2018 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR