facelessuser wrote:Hope you get it![]()
Cheers!
A layout splitting plugin is what I want it for. Messed around on one around xmas time but got `API stuck`
facelessuser wrote:Hope you get it![]()
castles_made_of_sand wrote:A layout splitting plugin is what I want it for. Messed around on one around xmas time but got `API stuck`
{
"replacements": {
// Example replacements
"html5_remove_deprecated_type_attr": {
"find": "(<(style|script)[^>]*)\\stype=(\"|')text/(css|javascript)(\"|')([^>]*>)",
"replace": "\\1\\6",
"greedy": true,
"case": false
},
"remove_html_comments": {
"find": "<!--[\\s\\S]+?-->",
"replace": "",
"greedy": true,
"case": true
}
}
}[
{
"caption": "Reg Replace: Example - Cleanup HTML",
"command": "reg_replace",
"args": {"replacements": ["html5_remove_deprecated_type_attr", "remove_html_comments"]}
}
]
castles_made_of_sand wrote:You could probably even put a scope selector restriction in.
I've always wished you could optionally pass a list of regions and/or a scope selector to the find_all api to further restrict the finds. If find_all returned regions in the ordering of the regions you passed it, eg (`[R(caret_pos, view.size()), R(0, caret_pos)]` seems like you could easily enough implement wrapped search that way. To restrict your search to a bunch of particular regions currently isn't as easy as it could be.
Some feedback of which regions were replaced would likely come in handy.
C0D312 wrote:For people looking for a link (like me):https://github.com/facelessuser/RegReplace
castles_made_of_sand wrote:Yeah, it's just tedious. It's just such a common task that it'd be nicer (and likely a lot more efficient) if there was a more direct api for it. You'll probably end up implementing replace restricted to selections for example.
castles_made_of_sand wrote:The scope selector would be used most commonly for restricting to, or filtering, string and comment scopes I'd imagine.
Users browsing this forum: Exabot [Bot] and 4 guests