I want to match a string to an array of strings, however I dont want all letters, all numbers, and the following . % included within that matching.
ie....
string:
would be a valid match
stringQ
string-
string9
would not
?
This doesn't make sense. The fnmatch() function takes two textual args: one is a pattern, the other is a literal string to match against the pattern. In your description, you have a single string and an array of other strings. You don't have any patterns.
Unless your single string is a pattern, or your array contains patterns, I don't see how fnmatch() can possibly do anything for you.
Regex won't help either, because it's just fancier pattern matching. It adheres to the same structure as fnmatch: does string X match pattern Y.
If you want to use pattern-matching in any form, you have to somehow figure out which one of your inputs will be the pattern, and then figure out how to make it be a pattern.
So now I'm back to the "What are you trying to accomplish?" question.
Please explain what the single string represents, and what the array of strings represent (or what each string in the array represents), and what you're trying to accomplish by comparing or matching them. We may be able to suggest something. Without knowing what you're trying to accomplish, and based on what you've said so far, pattern-matching alone will never do what you seem to want.
this seems to work, i think?
When I suggested testing it, I meant write a program and test the pattern you proposed against your actual input strings. If you have to say "this seems to work" or "I think?", then I can only assume you haven't performed an actual test of an actual program. Otherwise you'd have a definite answer: it works or it doesn't. And then if you'd posted "It doesn't work", I would have said "Post your code".