Regex basics

31 views
Skip to first unread message

Brother Bill

unread,
Jun 1, 2024, 11:15:50 AMJun 1
to Eiffel Users
Where can I find a REGEX class that does the basics?

rfo amalasoft.com

unread,
Jun 2, 2024, 9:14:01 AMJun 2
to eiffel...@googlegroups.com
The Eiffel distribution includes, in the contrib folders, the Gobo libraries and they include very good regular expression support.
R

From: eiffel...@googlegroups.com <eiffel...@googlegroups.com> on behalf of Brother Bill <brother...@gmail.com>
Sent: Saturday, June 1, 2024 11:15 AM
To: Eiffel Users <eiffel...@googlegroups.com>
Subject: [eiffel-users] Regex basics
 
Where can I find a REGEX class that does the basics?

--
You received this message because you are subscribed to the Google Groups "Eiffel Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eiffel-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/eiffel-users/d21c41fb-0c5b-4790-8820-a9682a3ae618n%40googlegroups.com.

Brother Bill

unread,
Jun 2, 2024, 4:02:40 PMJun 2
to Eiffel Users
What are the steps for finding the contrib folders or the Gobo libraries, and then incorporating them into the project?

rfo amalasoft.com

unread,
Jun 2, 2024, 4:50:27 PMJun 2
to eiffel...@googlegroups.com
The library is installed by default, or at least it was last time I checked.  Therefore, you need only call it out in your ecf file.

            <library name="gobo_regexp" location="$ISE_LIBRARY\library\gobo\gobo_regexp.ecf">
                  <option warning="none">
                  </option>
            </library>

R

Sent: Sunday, June 2, 2024 4:02 PM
To: Eiffel Users <eiffel...@googlegroups.com>
Subject: Re: [eiffel-users] Regex basics
 

Jocelyn Fiat

unread,
Jun 3, 2024, 9:03:03 AMJun 3
to eiffel...@googlegroups.com
Using the "Project settings" dialog from EiffelStudio, click on "Groups" on the tree.
Then in the toolbar, click on "Add Library (Ctrl+L)"
in the "filter" text field enter "regexp"

You get a list of libraries, among them
- "regexp": the mentioned GOBO Regexp library
   $ISE_LIBRARY\contrib\library\gobo\library\regexp\src\library.ecf
 
- "PCRE": similar to Gobo Regexp library, but without dependencies on Gobo libraries
   $ISE_LIBRARY\unstable\library\text\regexp\pcre\pcre.ecf

- "kmp_matcher": not really for regexp, but wild char  (using * and ? )
  $ISE_LIBRARY\library\text\regexp\kmp_matcher\kmp_matcher.ecf

Select the one you want, and click at the bottom on the button "[Include]"

I hope this helps








--
Jocelyn
------------------------------------------------------------------------
Eiffel Software
https://www.eiffel.com
Customer support: https://support.eiffel.com
User group: https://groups.google.com/forum/#!forum/eiffel-users
------------------------------------------------------------------------

Brother Bill

unread,
Jun 3, 2024, 2:50:35 PMJun 3
to Eiffel Users
Jocelyn Fiat,  That got me most of the way.  
For this case, testing for a regular expression match was sufficient for my needs at this time.
Note that Eiffel STRINGs treat the backslash character as just another character.  In Eiffel, "%N" is newline, not "\n".
Of course, we now have to watch out for "%", which are less common, especially in regular expressions.
Thus, there is no need to double backslashes or resort to another literal string mode as in C#.

Here is a link to a working example based on OOSC2, page 423.
https://www.adrive.com/public/q6B66P/p423%20Regex.zip

Examine INTEGER_READER lines 60 - 79.  (And yes, I know about once functions, but that hasn't been introduced in OOSC2 by page 423)

Also enclosed are step by step instructions.
p439 - External library routines.docx
Reply all
Reply to author
Forward
0 new messages