MatchX ( string ; search )
Matches consecutive characters only l-r not r-l yet
Average rating: 3.8 (46 votes) Log in to vote
Ian Moree Somethings Different http://somethingsdifferent.biz |
MatchX( "BahmiaN" ; "Lk" )
There was no Match
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Matches a set of characters such as
Ia
BA
U1
Comments
Lee Smith Mar 29, 2012 |
||
Was this working for you? | ||
Ian Moree, Nassau Bahamaas Mar 29, 2012 |
||
WOW! totally messed up the copy / paste Here is what i intended to past> /* ################################### Match v.1_0 by: Ian moree date: Mar 29, 2012 Definition: Match ( string; search ; ) eg. this finds chars in sequence {IA} , if not, then returns Message stating so // My first custom function- I am sure there is room for improvement,just dont know yet! ##################################### */ Case ( IsEmpty( string) or IsEmpty( search ); "" ; /* else */ Let( [ len = Length ( search ); pos = Position( string; search ; 1 ;1 ) ]; Case( pos = 0 ; 0 ; Exact (search; Middle ( string ; pos; len ) ) ) ) ) |
||
Lee Smith Mar 30, 2012 |
||
Initially I noticed that you had a typo in the Let statement POS = Position (text; search; 1:1) S/B POS = Position (string; search; 1; 1) In addition you had the opening case statements closing within the Let calculation, instead of at the end where it belonged. I tested your revised Custom Functions and I noticed that you modified the calculation for the Let so that it no longer gives statement “there was no match†Anyway, here is a modification of your original custom function, that I think does what you wanted to do. Case ( IsEmpty ( text ) or IsEmpty ( Search ) ; Get ( LastError ) ; Let ( [ len = Length ( Search ) ; pos = Position ( text ; Search ; 1 ; 1 ) ] ; Case ( pos = 0 ; "There was no Match" ; Middle ( text ; pos ; len ) ) ) ) //end case |
||
Ian Moree, Nassau Bahamaas Mar 30, 2012 |
||
thanks Lee. | ||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.