v icon indicating copy to clipboard operation
v copied to clipboard

Support case ignore in regex

Open kravlad opened this issue 7 months ago • 2 comments

Describe the feature

As far as I know the standard library’s regex module currently lacks support for case-insensitive matching (e.g., /pattern/i or similar functionality). I would like to request the addition of an option to perform case-insensitive regular expression matching.

Probably, the best way to implement this is to add a flag, for example f_ci.

Use Case

Case-insensitive matching is a common need when working with text, especially for parsing user input, processing natural language data, or implementing search functionality.

For example, with case-insensitive support, the pattern r'hello' would match "Hello", "HELLO", or "hElLo" without requiring complex workarounds or manually normalizing case in the input string or pattern.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • [ ] I may be able to implement this feature request
  • [ ] This feature might incur a breaking change

Version used

V 0.4.10 a91e2def83051b5ad177f89e058f4a09e79433ee

Environment details (OS name and version, etc.)

V full version V 0.4.10 a91e2def83051b5ad177f89e058f4a09e79433ee
OS macos, macOS, 15.5, 24F74
Processor 8 cpus, 64bit, little endian, Apple M1
Memory 0.3GB/16GB
V executable /Users/user/dev/v/v
V last modified time 2025-06-05 15:14:14
V home dir OK, value: /Users/user/dev/v
VMODULES OK, value: /Users/user/.vmodules
VTMP OK, value: /tmp/v_501
Current working dir OK, value: /Users/user
Git version git version 2.49.0
V git status weekly.2025.14-315-ga91e2def
.git/config present true
cc version Apple clang version 17.0.0 (clang-1700.0.13.5)
gcc version Apple clang version 17.0.0 (clang-1700.0.13.5)
clang version Apple clang version 17.0.0 (clang-1700.0.13.5)
tcc version tcc version 0.9.28rc 2024-02-05 HEAD@105d70f7 (AArch64 Darwin)
tcc git status thirdparty-macos-arm64 e447816c
emcc version N/A
glibc version N/A

[!NOTE] You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote. Other reactions and those to comments will not be taken into account.

kravlad avatar Jun 06 '25 16:06 kravlad

Connected to Huly®: V_0.6-23023

huly-for-github[bot] avatar Jun 06 '25 16:06 huly-for-github[bot]

Probably too heavy to implement as computation request. About the implementation it is not much complicated, need to modify this part of code: https://github.com/vlang/v/blob/0de2f742f0f349f6add41075dae7371aa704d443/vlib/regex/regex.v#L2511-L2537 and add the flag for "Case-insensitive"

I'm not sure that this feature is good for this simple regex lib. This feature will probably add at least one more if that will slow the check loop for sure.

penguindark avatar Jun 06 '25 19:06 penguindark