ctRegex with variable?
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Apr 12 14:59:56 PDT 2017
On 04/12/2017 02:25 PM, Jethro wrote:
> Can regex's have variables in them? I'd like to create a ctRegex but
> match on runtime strings that are known at runtime.
>
> e.g.,
>
> auto c = ctRegex~("x{var}")
>
> where var is a variable that is passed at runtime. e.g., match(s, c,
> "test") will replace var with test.
Sounds reasonable but the string would have to be constructed each time
match is called. It could reuse the same buffer... So, one needs to
profile to see how it performs and we expect you to implement and test
it please. ;)
Ali
More information about the Digitalmars-d-learn
mailing list