assert format of a string before a mixin

ddcovery antoniocabreraperez at gmail.com
Sun Sep 27 21:57:19 UTC 2020


On Sunday, 27 September 2020 at 21:41:25 UTC, Adam D. Ruppe wrote:
> On Sunday, 27 September 2020 at 21:38:43 UTC, ddcovery wrote:
>>> i.e. checking this Regex expression
>>> `^[a-zA-Z_]*[a-zA-Z0-9_]*[a-zA-Z][a-zA-Z0-9_]*$`
>>>
>>
>> Is there any way to check a regular expression at compile time?
>
> Not really and I'd actually suggest not trying because even if 
> it did work, it'd probably be very slow.
>
> But that regex there is pretty easy to translate to a little 
> hand-written loop function that would do the job runtime, ctfe 
> both and do it quickly.

Thanks Adam.


More information about the Digitalmars-d-learn mailing list