Page 1 of 1

RegExReplace optimisation

Posted: 10 Jun 2018, 02:23
by SL5
hi :wave:

In my list the lines are shortened and should still be understandable for humans.
Example of the line (other examples https://regex101.com/r/GQjPg0/3 :
Recent|r|C:\Users\bla\AppData\Roaming\Microsoft\Windows\Recent
will only
Recent :thumbup:
displayed.

That's great. :thumbup:

But if one line contains e.g.
Simple
will only
Sim :thumbdown:
displayed.
This is stupid. Simple alone would be understandable enough.

i use this regex:
^[_]*([^|\n]+)[^\.\n]*?([^|\n]{3,})$

and i test / develop it here:
https://regex101.com/r/GQjPg0/3

Re: RegExReplace optimisation

Posted: 10 Jun 2018, 05:14
by SirRFI
Provide more details. Do you want only first word to be displayed, part of the sentence (up to X symbols) or entire sentence till | symbol?

Re: RegExReplace optimisation

Posted: 10 Jun 2018, 08:31
by SL5
SirRFI wrote:Provide more details. Do you want only first word to be displayed, part of the sentence (up to X symbols) or entire sentence till | symbol?
thanks. a simple ? at the end did the job.

the green area is the visible part for the user.
the blue is metainformation for the script.
the red is what executed from the script (if there is now red and now blue part script set in the green part).

i use it i my github IntelliSense script.

BTW in the regex before also the file extension .ahk was cut of. its also ok i think to have it with extension. its also good readable with extension.

Re: RegExReplace optimisation

Posted: 10 Jun 2018, 09:24
by SirRFI
How about this?:
^[_]*([^|\n\r]+)(\|[^\.\n]+\|)?([^|\n\r]+)?$
https://regex101.com/r/GQjPg0/5

Re: RegExReplace optimisation  Topic is solved

Posted: 10 Jun 2018, 10:51
by SL5
SirRFI wrote:How about this?:
^[_]*([^|\n\r]+)(\|[^\.\n]+\|)?([^|\n\r]+)?$
https://regex101.com/r/GQjPg0/5
yes looks good :)

alle these follwong works nearly same. so i dont know which to prefer.
^[_]*([^|\n\r]+)(\|[^\.\n]+\|)?([^|\n\r]+)?$
^[_]*([^|\n]+)[^\.\n]*?([^|\n\r]+)?$
^[_]*([^|\n\r]+)[^\.\n]*?([^|\n\r]+)?$


first i tryid yours seems works not (see screenshot). do i something wrong?
maybe a server issue.

Re: RegExReplace optimisation

Posted: 10 Jun 2018, 12:06
by SirRFI
Untested in AHK though, but should behave the same.

Re: RegExReplace optimisation

Posted: 11 Jun 2018, 07:27
by SL5
SirRFI wrote:Untested in AHK though, but should behave the same.
sorry SirRFI yes yours work :thumbup: thats i already tried to say here:
SL5 wrote:...
first i tryid yours seems works not (see screenshot). do i something wrong?
maybe a server issue.
it was probably a server issue of the regex website :think: