I have an AD search module which works as I want it to; searching for a matching forename and/or surname in the appropriate OU.
I would like to extend it to be more flexible, so that instead of just searching for a matching string in the surname/forename fields it can match partial strings. I already have it applying a star to the end of the filter, which accomplishes part of this, but I would like it to match partial strings at the start as well, with more precision than just a starting wildcard.
Ideally I would like it to match any record where the search term is the start of the word in question, as this will allow multi-part surnames to work without needing to code every possibility.
For example, if the user searches for "zet", it will match a field containing "Zetten" (as the actual filter passed to the DirectorySearcher object is "zet*"), but not my actual name, "van Zetten". I would like it to match my name, but not a record such as "Unzetser", so a double-star search is not suitable.
Another example: If someone searches for "Lad" it should find "bin Laden" and "Ladbroke", but not "Salad".
I think what I need to do can be accomplished with a regular expression of some kind, so it will match any whitespace character (including the start of the field being searched) at the start of the search term, rather than a completely open double-wildcard search such as "*zet*".
But I don't know if the DS.filter property can use a regex at all, and the syntax to use if it can.
I hope that's clear enough; I can try to elaborate if necessary.