Regex brain failure...

Paul Dupuis paul at researchware.com
Sat Feb 3 19:39:36 EST 2024


https://regex101.com/ is exactly the site I ended up using. The step 
through debugger is perfect for fining where a particular pattern fails. 
It's what let me see there was a tab space tab where I expected a single 
tab in the data and correct teh regex for the data as it actually is.

On 2/3/2024 7:04 PM, Kaveh Bazargan wrote:
> For testing regex you might find it useful to use regex101. It's 
> excellent and you can save the page. I put your text here 
> <https://regex101.com/r/OwsGnl/1> just for testing. pls note your tabs 
> are corrupted in the email and I put an "a" to make it work just for test.
>
> On Sat, 3 Feb 2024 at 21:13, Paul Dupuis via use-livecode 
> <use-livecode at lists.runrev.com> wrote:
>
>     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
>
>
>     _______________________________________________
>     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
>
>
>
> -- 
> Kaveh Bazargan PhD
> Director
> River Valley Technologies <http://rivervalley.io> ● Twitter 
> <https://twitter.com/rivervalley1000> ● LinkedIn 
> <https://www.linkedin.com/in/bazargankaveh/>● ORCID 
> <https://orcid.org/0000-0002-1414-9098> ● @kaveh1000 at mastodon.social 
> <https://mastodon.social/@kaveh1000>
> *Accelerating the Communication of Research*
> *<https://www.linkedin.com/posts/bazargankaveh_ismte-innovation-award-recipient-kaveh-bazargan-activity-7039348552526921728-XAEB/?utm_source=share&utm_medium=member_desktop> 
> https://rivervalley.io/gigabyte-wins-the-alpsp-scholarly-publishing-innovation-award-using-river-valleys-publishing-technology/ 
> <https://rivervalley.io/gigabyte-wins-the-alpsp-scholarly-publishing-innovation-award-using-river-valleys-publishing-technology/>
> *


More information about the use-livecode mailing list