Skip to main content
Joseph von Arx
Participating Frequently
Mar 22, 2023 4:44 PM UTC

Parsing and matching a string against a pattern

Hello everyone,

I am trying to parse a string against a pattern and return a delimited list of tokens.  OpenQM has a Parse() function but there is no equivalent in Universe that I can see.  Has anyone done something similar?

For instance, if I have something like below:

string = "Give me 97 bananas"

tokens = Parse(string, "0X0N0X", Char(254))

I would like tokens variable to contain "Give me ":Char(254):"97":Char(254):" bananas"

Any help or suggestions would be appreciates.



------------------------------
Joseph von Arx
Software Developer
Data Management Associates Inc DMA
Cincinnati OH US
------------------------------

    11 replies

    Joseph von Arx
    Participating Frequently
    Mar 31, 2023 12:32 PM UTC

    Joseph,

    Myself and Neil have got to the bottom of this ... for your example to work you need to have PI_MATCHFIELD set to 1 in the uvconfig file, the $OPTIONS makes a difference when PI_MATCHFIELD is set to 0 but it is still incorrect. When we looked at the test machines we were using, one had it turned on and another did not. Once it was set the program behaved as expected.

    So the answer is set PI_MATCHFIELD to 1


    Thanks,



    ------------------------------
    Jonathan Smith
    UniData ATS
    Rocket Support
    ------------------------------

    Thanks for that information.  This makes me consider programming my own MATCHES function so I know exactly how it works on every system.  I may not be able to change config settings.



    ------------------------------
    Joseph von Arx
    Software Developer
    Data Management Associates Inc DMA
    Cincinnati OH US
    ------------------------------