You are here: PSPad forum > English discussion forum > Replace any characters with 3 characters.
Posted by: maki | Date: 2018-04-28 18:41 | IP: IP Logged
Replace any characters with 3 characters.
I am asking for a regular expression to Replace any number of characters to 3.
=======
=====================
======
Always Replace with:
===
(3 character)
Posted by: pspad | Date: 2018-04-28 18:50 | IP: IP Logged
Search: =+
Reaplace: ===
[x]Regular expressions
Posted by: maki | Date: 2018-04-29 12:30 | IP: IP Logged
100% works, many thanks.
Posted by: therium | Date: 2018-09-09 13:34 | IP: IP Logged
In Perl syntax where $s is a variable holding a string:
$s=~s/={4,}/===/; # Replace 4 or more equals with just 3 equals.
I do this a lot to replace 2 or more spaces with one space:
$s=~s/ {2,}/ /g; # Replace 2 or more spaces with just one space.
Edited 1 time(s). Last edit at 2018-09-09 13:34 by therium.
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