Commit Graph

11 Commits

Author SHA1 Message Date
Guldoman 757b906ca2 Make empty groups in `regex.gmatch` return their offset (#1325)
This makes `regex.gmatch` behave like `string.gmatch`.
2023-08-07 15:01:50 +01:00
jgmdev 79908baed6 regex: properly call pcre2_jit_compile 2022-12-28 19:40:20 -04:00
jgmdev 0ab7fe9311 core regex: use backward compatible lua_newuserdata 2022-12-21 00:54:12 -04:00
Jefferson González 3c64c32379
core: ported regex.gsub to faster native version (#1233)
* added regex.gmatch iterator and other fixes
* fixed issues reported by Guldoman
* push strings with fixed len just in case for binary safety
* added limit to regex.gsub and use pushinteger
* added description to regex.gsub limits param
* replaced substitutions regex description for correctness
* ignore negative limits on regex.gsub
2022-12-20 17:46:37 -04:00
Guldoman 74f7389cac
Make regex API return integers 2022-05-28 01:20:41 +02:00
Guldoman fbb893c6b1
Fix `^` regex matching when using an offset
Before, if `offset > 1` was used, the match would have failed because 
the beginning of the string was never met.

Now we force the beginning of the string to be the one specified by the 
offset.
2022-03-03 22:09:48 +01:00
Jan200101 99ddf1fb92
Migrate to Lua 5.4 2021-12-31 13:53:01 +01:00
Guldoman 038e335c8c
Show error message when `pcre2_match` fails 2021-10-11 22:20:44 +02:00
Adam Harrison 0777a6f0b8 Merged dev to master. 2021-07-20 14:39:50 -04:00
Adam Harrison 3b816a2b4a Changed regex error handling, so that errors can be handled gracefully in lua, and made it so gsub returns the exact matches and replacements. 2021-06-04 23:58:17 -04:00
Adam 248d70a8ca
Add PCRE to support regular expressions
Use regular expressions instead of Lua patterns for find and replace editor commands.

Syntax files can now use regex or Lua patterns as before keeping backward compatibility for plugins.
2021-06-02 21:27:00 +02:00