cancel
Showing results for 
Search instead for 
Did you mean: 

How to run regex in CubeIDE version: 1.11.0

RockyBalboa
Associate II

Hello community. I have question. I would like to use regular expressions regex. It adds #include <regex.h> and tries to use the regcomp or regexec function. Unfortunately after compilation I get the error "undefined reference to regcomp". How do I get regex to work in CubeIDE version 1.11.0, what do I need to do?

7 REPLIES 7

I saw this topic but I don't know how i put this library https://github.com/kokke/tiny-regex-c to CubeIDE

git clone/download the re.c and re.h files and put them in the Inc/Src folder of your project. Include "re.h" The API is different, but looks straightforward to me.

hth

KnarfB

Ok I will try

Ok this library work but regex created by me not working in this library :( I must check string like |2|20| . I use ^\\|([0-9]+\\|)+$ .For there to be a positive result there must be two | characters and a decimal number between them. In normal c compiler this work but in this library not working

Have you tried testing it on https://regex101.com/ ? For me the sequence ^\|(\d+\|)+$ works on regex101. In C that would be "^\\|(\\d+\\|)+$" . If you debug the library what happens?

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.
KnarfB
Principal III

The bar | is not used in re.c so there is no need for escape. It's probably only a matter of correct backslashing. But I think the OP shall find that out by reviewing the source or debugging or trial-and-error.

hth

KnarfB