-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
regexOps clarification needed #83
Comments
By the way, to see embedded code from RunKit you can install its app: |
In the meantime I will use this: "566000436feed43com>23537": {
"title": "Sai 2.0 Development Feed",
"link": "https://feed43.com/4432030375688680.xml",
"channel": "204593356007931905",
"addedOn": "2018-12-15T06:24:35.841Z",
"message": "📰 | **{title}**\n\n{description:newline}\n\n{link}\n\n{date}\n\n{subscriptions}",
"regexOps": {
"description": [
{
"name": "newline",
"search": {
"custom": true,
"flags": "g",
"regex": "\\s(\\[(?:Fixed|Changes|New)| *- )|\\*-- Delivered by Feed43 service\\*"
},
"replacement": "\n$1"
}
]
}
} |
To replace with a certain match and/or group, use the keys https://github.com/synzen/Discord.RSS/wiki/Custom-Placeholders-via-Regex-Ops#usagesyntax |
It's not possible:
"regexOps": {
"description": [
{
"name": "newline",
"search": {
"flags": "g",
"regex": "\\s(\\[(?:Fixed|Changes|New)| *- )|\\*-- Delivered by Feed43 service\\*",
"group": 1
},
"replacement": "\n$1"
}
]
}
"regexOps": {
"description": [
{
"name": "newline",
"search": {
"flags": "g",
"regex": "\\s(\\[(?:Fixed|Changes|New)| *- )|\\*-- Delivered by Feed43 service\\*",
"group": 1
},
"replacement": "\n$&"
}
]
} Note - here I am trying to replace with the \n + last match But I need replace all matches (not groups) with first group in original regex and it's not possible if I specify the match/group. Ok let's try this part of code:
In this case matches are:
11 new instances of RegExp, every replacement of match |
Just for testing: |
It is difficult to explain what I want in English. "regexOps": {
"description": [
{
"name": "newline",
"search": {
"custom": true,
"flags": "g",
"regex": "\\s(\\[(?:Fixed|Changes|New)| *- )|\\*-- Delivered by Feed43 service\\*"
},
"replacement": "\n$1"
}
]
} with this commit https://github.com/Chilace/Discord.RSS/commit/96dc9c73f1d72964ce1d750666b4b057ba29d956 |
Yes I understand now, try 62ddc26. Replace the |
These are feed settings:
and that is what I get:
![2018-12-15 15-51-45 playground - discord](https://user-images.githubusercontent.com/22879802/50043263-f3a57980-0081-11e9-83b3-a70197f5add3.png)
![2018-12-15 16-13-41 regexops test runkit - google chrome](https://user-images.githubusercontent.com/22879802/50043396-73ccde80-0084-11e9-84f3-7a097d1e5f39.png)
Some test:
https://runkit.com/chilace/5c14d678cf5f680012b650f0
The question is how to replace matches with a captured group?
The text was updated successfully, but these errors were encountered: