[AccessD] Asterix

Michael Bahr jedi at charm.net
Mon Feb 27 11:24:31 CST 2012


This is painful and inflexiable as with using the left, mid, right
functions.  Yes they work but they are rather static and for one string
pattern.  Using regular-expressions would reduce this to just a few lines
and be very flexiable and cover a wide range of patterns.  The only
problem is learning regular-expressions but then, once you learn it you
will wonder why you did not do so before.  :-)

Mike

> Hey All
> Some code that may help. Didn't want to try writing tons of code for all
> the
> reserved words, so I use this code, nothing fancy by any means but it
> seems
> to be working fine. Except for multiple asterixs. Search for everything
> containing *** and it returns **a, ***b, ****d, *e*, ***f*** etc. Not a
> biggy because I can see the asterixs. Also I am getting tired of fooling
> around with this thing.
>
> If Mysearch=1 ..........Starts With
> If Len(Me!MyPhrase = 1 Then
>     Zimbo = "[" & Left(Me!MyPhrase, 1) & "]" & "*"
> Else
>     If Len(Me!MyPhrase) = 2 Then
>         Zimbo = "[" & Left(Me!MyPhrase, 1) & "]" & "[" &
> right(Me!MyPhrase,
> 1) & "*"
>     Else
>         Zimbo =  "[" & Left(Me!MyPhrase, 1) & "]" & Mid(Me!MyPhrase, 2,
> Len(Mid(Me!        MyPhrase,    2)) - 1) & "[" & Right(Me!MyPhrase, 1) &
> "]"
> & "*"
> else .........Contains
> If Len(Me!MyPhrase = 1 Then
>     Zimbo ="* & "[" & Left(Me!MyPhrase, 1) & "]" & "*"
> Else
>     If Len(Me!MyPhrase) = 2 Then
>         Zimbo ="*" & "[" & Left(Me!MyPhrase, 1) & "]" & "[" &
> right(Me!MyPhrase, 1) & "*"
>     Else
>         Zimbo ="*" &  "[" & Left(Me!MyPhrase, 1) & "]" & Mid(Me!MyPhrase,
> 2,
> Len(Mid(Me!MyPhrase,    2)) - 1) & "[" & Right(Me!MyPhrase, 1) & "]" & "*"
>
> End If
> MyWord = Zimbo
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>




More information about the AccessD mailing list