Expression that detects patterns

Steve Lime Steve.Lime at DNR.STATE.MN.US
Sat Apr 21 09:56:32 EDT 2007


That's a limitation in the logical expression handler. You can't use regex [...] notation in an embedded regex. You can if the regex is a stand-along. For example:

CLASSITEM 'SUB'
CLASS
  EXPRESSION /'[string]'/
END 

That said I think you might need a different regex (you don't need the qoutes either). If you want all features where item foo starts with bar you'd do:

  EXPRESSION /^bar/

If you want one where bar can be anywhere in foo use:

  EXPRESSION /bar/

Steve

>>> Lawrence Hartpence <hartpence_gis at CO.JASPER.IA.US> 04/20/07 2:26 PM >>>
Hello.

I want to perform an ItemQuery that will find a certain string subset whether it 
appears at the beginning, end or middle.  I thought it was something like this: 
('[SUB]' =~ /'[string]'/).  I thought this was how you looked for a goroup of 
letters, but MapServer thinks that [string] is an item.  I used this expression 
with some success: ('[SUB]' =~ /'.string.'/), but this does not give me 
anything that starts or ends with the string; only cases where the string is in 
the middle.

Any help in how to do this would be appreciated.

Lawrence Hartpence



More information about the mapserver-users mailing list