Regex brain failure...
Paul Dupuis
paul at researchware.com
Sat Feb 3 16:12:27 EST 2024
Never mind.
The correct pattern is: ^\d+?\t.\tnontraditional
field\tText\t2,319\tInterview 1\.txt$
There is a column with a space in it between the number column (1st
column) and the 3rd column (which I thought was the 2nd column) that has
the code name in it (ie. nontradtional field). Now to figure out why
that is!
On 2/3/2024 1:36 PM, Paul Dupuis via use-livecode wrote:
> I have a (reduced) example set of data in a variable "tCaseCodes" that
> is tab delimited set of lines below:
>
> 1 I am making a high salary Text 2,319 Interview 1.txt
> 2 nontraditional field Text 2,319 Interview 1.txt
> 3 gets married and stays married Text 453,561 Interview
> 1.txt
> 4 wants kids Text 927,1009 Interview 1.txt
> 5 leaves work when kids born doesn't return Text
> 1012,1609 Interview 1.txt
> 6 takes major responsibility for family work Text
> 1012,1609 Interview 1.txt
>
> I have a Regex pattern in the variable "tCodeToMatch" shown below:
>
> ^\d+\tnontraditional field\tText\t2,319\tInterview 1.txt$
>
> I am executing the line of livecode script:
>
> filter lines of tCaseCodes with regex tCodeToMatch into tDuplicates
>
> The variable tDuplicates should then contain:
>
> 2 nontraditional field Text 2,319 Interview 1.txt
>
> But is instead, empty.
>
> Clearly, I must have made a Regex pattern mistake, but I am not seeing
> it. It is ^(start of line) \d+(any number of digits) \t(tab)
> nontraditional field \t(tab) Text \t(tab) 2,319 \t(tab) Interview
> 1.txt $(end of line)
>
> I thought that the period in the file name (Interview 1.txt) may have
> been an issue as period is a reserved regex character to match a
> single character. However, I get the same empty result if I escape the
> period, so it must be something else. I believe \d+ gets me an integer
> as the number in this column could be several digits long.
>
> A second set of regex eyes would be appreciated.
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list