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: 2018-06-29 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: 2018-06-29 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 2018-06-29 08:26 by pspad.

Options: Reply | Quote | Up ^


#13 Re: Regex issue (percentages)

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

image

Options: Reply | Quote | Up ^


#14 Re: Regex issue (percentages)

Posted by: vbr | Date: 2018-06-29 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 2018-06-29 15:49 by vbr.

Options: Reply | Quote | Up ^


#15 Re: Regex issue (percentages)

Posted by: aGerman | Date: 2018-06-29 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: 2018-06-29 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 2018-06-29 17:27 by pspad.

Options: Reply | Quote | Up ^


#17 Re: Regex issue (percentages)

Posted by: Andreas | Date: 2018-06-30 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: 2018-07-05 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: 2018-07-05 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: 2018-07-06 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 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR