PDA

View Full Version : Suggestion: RegEx matching



NewsArchive
05-13-2010, 02:43 AM
I'd like to see a way of doing a Regular Expression match on a variable
in the If structure. E.g. in my current install project, I'd like to
make sure the user selects the root directory of a drive as the
installation directory. I'd love to be able to do something like

If %_SB_INSTALL_DIR% Matches "^[a-zA-z]:\?$" Then

This would evaluate as true only if %_SB_INSTALL_DIR% contained only a
single character and a colon, followed by an optional backslash. Doing
this match without regular expressions requires much more complicated
logical expressions.

If you do this, please, please, PLEASE provide a better Regex
implementation than the lousy one Softvelocity provides for Clarion's
Match function (though I'll admit that that would be sufficient for the
example regex above). You might want to look at PCRE
(http://www.pcre.org/), which is BSD licensed, so it can be incorporated
into proprietary software.

Ben
- --
Ben Coleman
CTO, Accelerated Design, Inc.
http://www.accelerateddesign.com/

NewsArchive
05-14-2010, 01:19 AM
Hi Ben,

> E.g. in my current install project, I'd like to make sure the user selects
> the root directory of a drive as the installation directory.

What about using a method similar to the "select drive" demo in the "Combo
Box 2.sb7" source code example? (see attached screenshot). Your users can
select the drive and you can set the installation directory to the root.

http://www.lindersoft.com/sb7_Examples.exe

Friedrich

NewsArchive
05-14-2010, 01:20 AM
BTW, I like your RegEx implementation suggestion.

Friedrich

NewsArchive
05-14-2010, 01:21 AM
> BTW, I like your RegEx implementation suggestion.

Thanks. When you've gotten used to having RegEx functionality (I'm an
old Perl programmer), you really miss it when it's not there.

Ben
- --
Ben Coleman
CTO, Accelerated Design, Inc.
http://www.accelerateddesign.com/

NewsArchive
05-14-2010, 01:21 AM
> What about using a method similar to the "select drive" demo in the "Combo
> Box 2.sb7" source code example? (see attached screenshot). Your users can
> select the drive and you can set the installation directory to the root.

Hmmm. I ended up going to something similar (though I would still like
to see the Regex matching). Since I'm actually expecting the drive to
be a flash drive, I manually enumerated the drives and used GetDriveType
to select the removable drives, and used a list dialog to allow the user
to select one of them. But the example shows a couple of places where I
can tighten up my code (e.g. by using Enumerate Disk Drives, but I still
need to go through those and select the removable ones).

Ben
- --
Ben Coleman
CTO, Accelerated Design, Inc.
http://www.accelerateddesign.com/

NewsArchive
06-23-2010, 12:30 AM
>> BTW, I like your RegEx implementation suggestion.
>
> Thanks. When you've gotten used to having RegEx functionality (I'm an
> old Perl programmer), you really miss it when it's not there.

'If String Matches RegExp Then'

and

'If String Does Not Match RegExp Then' "If..." statements added.

Thank you again for your suggestion.

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

SetupBuilder is Windows 7 installation -- "point. click. ship"

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
06-23-2010, 12:31 AM
Friedrich

NewsArchive
06-23-2010, 12:31 AM
Cool!

Jane Fleming

NewsArchive
06-23-2010, 12:31 AM
>
> Cool!
>

:-)

Friedrich

NewsArchive
06-29-2010, 02:22 AM
> 'If String Matches RegExp Then'
>
> and
>
> 'If String Does Not Match RegExp Then' "If..." statements added.

Excellent!

> Thank you again for your suggestion.

You're quite welcome. Now, if we can just get Softvelocity to beef up
the regex implementation in Clarion's Match function.....

Ben
- --
Ben Coleman
CTO, Accelerated Design, Inc.
http://www.accelerateddesign.com/