RegEx extension

Hi !

Looking for a way (extension?) supporting not only match/nomatch but returning groups/subgroups as well
The nice extensions by Kevin 正则表达式插件 · 浮云小站 and Puravida Apps can not be used (lacks groups functionality).

Simplified example of data to match: "callsign:6AA1AA NOTES:13 tricky<inside QSODATE:8 20221212 <...
Simplified regexp : ^<([A-Za-z]+):(\d+)>.+
It returns 2 groups: "callsign", "6"
Then I take subsequent content ("AA1AA") and repeat.
Kevin's will just return match/no match.

(I even tried to write my own ext but https://editor.appybuilder.com/ is not accessible)

Any ideas ?

You could do it with javascript in a webviewer

If you want to write your own extension use RUSH

Thanks @TIMAI2.
Webviewer sounds so heavy..
Rush - I'll investigate it - it's documentation will take a while .

Has anybody tried Rapid ? SO far I created simple extension that returns number but any use of list throws unspecified error while building so looks like NotImplemented yet or I still need to master it...

It doesn't have to be visible (the webviewer), and turn around of run javascript code is almost instant

Regardless, I am certain @Kevinkun may be able to assist you with the regex extension if you provide a full input and regex, and expected output.

is this your complete string?

The above code was parsed into groups like this.. Isnt?

Output:

[
  [
    'callsign:6AA1AA',
    'callsign',
    '6AA1AA',
    index: 0,
    input: 'callsign:6AA1AA NOTES:13 tricky<inside QSODATE:8 20221212 < ',
    groups: undefined
  ],
  [
    'NOTES:13',
    'NOTES',
    '13',
    index: 16,
    input: 'callsign:6AA1AA NOTES:13 tricky<inside QSODATE:8 20221212 < ',
    groups: undefined
  ],
  [
    'tricky<inside',
    'tricky',
    'inside',
    index: 25,
    input: 'callsign:6AA1AA NOTES:13 tricky<inside QSODATE:8 20221212 < ',
    groups: undefined
  ],
  [
    'QSODATE:8',
    'QSODATE',
    '8',
    index: 39,
    input: 'callsign:6AA1AA NOTES:13 tricky<inside QSODATE:8 20221212 < ',
    groups: undefined
  ],
  [
    '20221212',
    '202212',
    '2',
    index: 49,
    input: 'callsign:6AA1AA NOTES:13 tricky<inside QSODATE:8 20221212 < ',
    groups: undefined
  ]
]

For questions concerning Rapid, please ask in the Rapid community

https://community.rapidbuilder.tech

Taifun

There IS a GetMatches function
in regex extension

Yes. Works nice thanks for nice ext. But I don't know how to return group list not just whole match . Rgds, Kuba

I've just realized < must be escaped or editor will interpret and hide, so simplified example of data to match:
"<callsign:6>AA1AA <NOTES:13> tricky<inside <QSODATE:8> 20221212 <...
Simplified regexp : ^<([A-Za-z]+):(\d+)>.+
It returns 2 groups: "callsign", "6"
Then I take subsequent content ("AA1AA") and repeat.

Sorry

sorry i don't understand

what about only this

<([A-Za-z]+):(\d+)>
1 Like

@Kevinkun
Regex has concept of match (whole string) and its parts and subparts within that matched string (groups). I use match to make sure that input is as expected and get token name, token lenght and maybe even token value as groups (as in regex101.com)..
Anyway thanks for prompt support and agn tnx for nice ext.

And yes it can probably acieved without groups too.

Kuba

@Spicy_Topics
Thnx I will look i to JavaScript in webviewer

No need already extension is there to run js instead of webviewer

Ref here

I have used this script

matchAll(/(\w+)[:\d< ](\w+)/g);

Thanks for all your suggestions. Now it is my time to work on these. Thanks a lot, you are great !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.