February 03, 2011 Re: std.regex bug? My regex doesn't match what it's supposed to. | ||||
---|---|---|---|---|
| ||||
Alex Folland Wrote:
> The problematic string:
>
> Guaton_at_9min59sec.WAgame
Might I suggest using a simpler regex? It gives the ability to do better error checking/reporting. Instead of adding all the misspellings for minute and second, just capture those locations as words and analyze them outside the regex. In fact you could capture the whole time segment and use a second regex to pull out the data:
regex("(\d+\w+)", "g")
Then your regex isn't updated when you need to add hours and such.
|
February 04, 2011 Re: std.regex bug? My regex doesn't match what it's supposed to. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | On 2011-02-03 17:03, Jesse Phillips wrote:
> Alex Folland Wrote:
>
>
>> The problematic string:
>>
>> Guaton_at_9min59sec.WAgame
>
> Might I suggest using a simpler regex? It gives the ability to do better error checking/reporting. Instead of adding all the misspellings for minute and second, just capture those locations as words and analyze them outside the regex. In fact you could capture the whole time segment and use a second regex to pull out the data:
>
> regex("(\d+\w+)", "g")
>
> Then your regex isn't updated when you need to add hours and such.
I finished my function today. :) I did end up using shorter regexes and embedded foreach loops in order to break the timecodes down. However, the whole timecodes were found by a relatively large and adaptive regex, which seems to be necessary. Thanks for the tip though. It helped further down the line.
|
Copyright © 1999-2021 by the D Language Foundation