Posted by: maki | Date: 2019-04-04 14:57 | IP: IP Logged
I need regex REPLACE
Edited 2 time(s). Last edit at 2019-04-04 14:58 by maki.
Posted by: pspad | Date: 2019-04-04 15:20 | IP: IP Logged
You can't use regular expression in replace. Learn how to use substitute groups in replace. Regular expression manual with examples is available in the PSPad help and as I remember, you told you read the help from first to last letter.
Posted by: maki | Date: 2019-04-04 15:36 | IP: IP Logged
Quote:You can't use regular expression in replace.
Can change some, for example, \1 or $1 or $2 etc. (regex) Escape Special Character
The help file requires learning from basic, and I'm lazy. Unfortunately, I have no knowledge how to replace in URLs.
I could change it manually, but I am looking for a pattern for automatic detection (Link Crawler) of URLs and changes.
Edited 2 time(s). Last edit at 2019-04-04 15:42 by maki.
Posted by: vbr | Date: 2019-04-04 17:55 | IP: IP Logged
you can enclose the parts of the text, which should be manipulated for replacement with parens and resore these mached groups in the replacement pattern with numbered parts: $1
cf. the simplified example:
resulting text after replacement:
I guess it should be possible to adapt this patterns to match your specific data.
Posted by: maki | Date: 2019-04-04 19:08 | IP: IP Logged
My regex is wrong anyway!
Edited 2 time(s). Last edit at 2019-04-04 19:18 by maki.
Posted by: maki | Date: 2019-04-05 18:52 | IP: IP Logged
@vbr - It seems to be more complicated than I thought, it must be according to this formula:
"pattern" : "pattern"
you specify the pattern that matches the rule
you can specify max depth (how deep the same rule can go)
"maxDecryptDepth" : 0
you can specify name (for yourself or when you share rules)
"name" : "Test"
you can specify pattern (DEEPDECRYPT) that returns the name of the package for all found links
"packageNamePattern" : "pattern"
you can specify pattern (SUBMITFORM) that selects the form to submit
"formPattern" : "pattern"
you can specify pattern (DEEPDECRYPT) that returns inner links/html to parse
"deepPattern" : "pattern"
you can specify pattern (REWRITE) to rewrite URL ($1 is first match, $2 is second match...)
"rewriteReplaceWith" : "$1"
Posted by: vbr | Date: 2019-04-06 07:00 | IP: IP Logged
as you might see, this is mostly unrelated to regex and certainly not relevant to PSPad; however, you may ask such questions in an appropriate forum, as suggested there:
Posted by: maki | Date: 2019-04-06 09:34 | IP: IP Logged
vbr - However, I only need regular expressions (match to link and rewrite), other things I know how to do.
And regular expressions are part of PSPad. Is not it?
Posted by: vbr | Date: 2019-04-06 13:13 | IP: IP Logged
Ok, in that case the quoted parts from the documentation are not relevant. But especially, the requirements for stable parts of the links and those needing replacement are not clear.
it seems in your samples, that the parentheses capture actually the parts to be discarded, you
Basically you need to capture the needed parts of the matched string to parens and recombine them in the replacement pattern, e.g.:
For referencing the captured groups (matched inside of parens) the metacharacters $ folowed by a number are used in the replacement pattern - in PSPad and apparently in your crawler tool too.
Other variants of regular expression engines use \ followed by a number here, which also appears in your samples.
Posted by: maki | Date: 2019-04-06 16:50 | IP: IP Logged
A very understandable explanation!!!
Regex only for translation !!!
This does not mean changes !!!
Real Replace with:..........?
Now is born asking how to change it?
Edited 10 time(s). Last edit at 2019-04-06 16:56 by maki.