Regex brain failure...

Paul Dupuis paul at researchware.com
Sat Feb 3 13:36:44 EST 2024


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.



More information about the use-livecode mailing list