You are here: PSPad forum > English discussion forum > Talk about regular expressions

Talk about regular expressions

Goto Page: Previous1 2 3 4 Next

#11 Re: Talk about regular expressions

Posted by: pspad | Date: 2020-02-05 17:06 | IP: IP Logged

Read my answer again

You wrote you want to find something and replace it with new line, right?
So you are looking for new line and you replaces it with anything. Strange...

Maybe you don't know what are you doing, maybe don't know what do you want to do.

Write your answer agin like this:

I have line: xxxxxxxx
I want to have line: yyyyyyyyyy

So I need to replace xxx with yyy
Or I want to add on the end of the line: zzzz

Edited 1 time(s). Last edit at 2020-02-05 17:07 by pspad.

Options: Reply | Quote | Up ^


#12 Re: Talk about regular expressions

Posted by: maki | Date: 2020-02-05 17:25 | IP: IP Logged

I want insert text into lines: at lines end
I want to use regex

Find: (.)$

Replace: \1\\n

Hm?

Edited 1 time(s). Last edit at 2020-02-05 17:30 by maki.

Options: Reply | Quote | Up ^


#13 Re: Talk about regular expressions

Posted by: pspad | Date: 2020-02-05 17:36 | IP: IP Logged

Do you want to add text on the end of line + add another line end ?

Options: Reply | Quote | Up ^


#14 Re: Talk about regular expressions

Posted by: maki | Date: 2020-02-05 17:39 | IP: IP Logged

Example. I have URL(links) on each line and want to insert #.test at the end of each URL.
Simple and understandable?

Options: Reply | Quote | Up ^


#15 Re: Talk about regular expressions

Posted by: pspad | Date: 2020-02-05 17:44 | IP: IP Logged

Finally yes. Why don't you write it in your question?
What is written when you click on '?' button for the end of the line?

Search: $
Replace: #.test

Options: Reply | Quote | Up ^


#16 Re: Talk about regular expressions

Posted by: maki | Date: 2020-02-05 18:47 | IP: IP Logged

If $ sign is at the end of a regular expression, the matched string must be at the end of the string being find.

Do you know such a little-known alternative? grinning smiley

Search: \Z
Replace: #.test

Thanks. Working.

Edited 1 time(s). Last edit at 2020-02-05 18:48 by maki.

Options: Reply | Quote | Up ^


#17 Re: Talk about regular expressions

Posted by: pspad | Date: 2020-02-05 18:58 | IP: IP Logged

Show real examples if you want real answer

Options: Reply | Quote | Up ^


#18 Re: Talk about regular expressions

Posted by: maki | Date: 2020-02-05 19:11 | IP: IP Logged

But how do I want to ignore whitespace???

\s*$

Example:

Line1:172349 0
Line2:12345

Replace with:
Line1:172349#.test
Line2:12345#.test

sad smiley

Options: Reply | Quote | Up ^


#19 Re: Talk about regular expressions

Posted by: pspad | Date: 2020-02-05 19:23 | IP: IP Logged

Sample:
172349 0
12345

search: ^(\d+).*
replace: $1#.test

Options: Reply | Quote | Up ^


#20 Re: Talk about regular expressions

Posted by: maki | Date: 2020-02-05 19:40 | IP: IP Logged

What search type if it is any url (sample)?

Edited 2 time(s). Last edit at 2020-02-05 19:41 by maki.

Options: Reply | Quote | Up ^


Goto Page: Previous1 2 3 4 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