Filter with Regular Expression

Use this forum to ask questions about how to do things in QCAD.

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files and screenshots.

Post one question per topic.

Post Reply
User avatar
dfriasb
Senior Member
Posts: 119
Joined: Thu Mar 10, 2016 1:08 pm
Location: Calafell, Tarragona, Spain

Filter with Regular Expression

Post by dfriasb » Sun Jan 07, 2018 10:57 am

Hello all,

Where can I find the syntax for filtering using Selection Filter widget with Regular Expressions?
I'm trying expressions like "2+1", "=2+1", etc. but they are not working...

Thanks!!

David
Attachments
Screenshot from 2018-01-07 10-56-02.png
Screenshot from 2018-01-07 10-56-02.png (325.45 KiB) Viewed 3437 times
David Frías Barranco | architect
[email protected] | davidfriasarquitecto.es

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: Filter with Regular Expression

Post by andrew » Mon Jan 08, 2018 11:06 am

Regular expressions can be used to define a search pattern. Regular expressions can be very complex, but there are also some simple but useful ones:

"ABC.*" matches layers starting with "ABC"
".*ABC" matches layers ending with "ABC"
".*ABC.*" matches layers containing "ABC"
"[1-4]" matches numbers 1 to 4
"\d" matches a digit

More information:
https://regexone.com/
http://www.rexegg.com/regex-quickstart.html
and others...

This examples would match everything on layers "layer 2" and "layer 3":
Screen Shot 2018-01-08 at 09.56.58.png
Screen Shot 2018-01-08 at 09.56.58.png (51.55 KiB) Viewed 3414 times

User avatar
dfriasb
Senior Member
Posts: 119
Joined: Thu Mar 10, 2016 1:08 pm
Location: Calafell, Tarragona, Spain

Re: Filter with Regular Expression

Post by dfriasb » Mon Jan 08, 2018 11:23 am

Very interesting!
Thank you!!
David Frías Barranco | architect
[email protected] | davidfriasarquitecto.es

Post Reply

Return to “QCAD 'How Do I' Questions”