Does javascript have a wildcard character such as * or % ? If so, how do you use it? If not, what alternatives are there to use?
Does javascript have a wildcard character such as * or % ? If so, how do you use it? If not, what alternatives are there to use?
If yo mean in terms of text manipulation, yep, via Regular Expressions. You may want to read up on Introductory Guide to regular expressions.
p,s: I've shortened your sig, since the length of it made it easy to confuse it with your actual posts.
Thanks for the link, i'll be sure to check it out!
A more extensive guide to regex can be found at http://www.regular-expressions.info/.
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Last night, I put the finishing touches on a plugin for JXtension which allows you to use wildcards to search a string. It gives the user the capability to turn wildcard expressions into regular expressions. I know that many people have wondered if you could use wildcards in JavaScript, therefore I plan on adding this plugin to JXtension 1.1. On the other hand, if you don't think that it would be useful, perhaps I will leave it as a plugin. Since the goal of JXtension is to help the webmasters develop code faster, what do you think? Do you think that this would be a useful feature? Please reply here or take the poll and reply on my forum by clicking here.
Last edited by bardonw; 12-02-2009 at 06:13 PM.
Since jPaq has replaced JXtension, jPaq is the library that now gives you the ability to search strings with wildcard characters. Here are the three examples that are on the jPaq home page:
Code:alert("Where in the world is Carmen Sandiego?".findPattern("C*n")); alert("Christopher West".replacePattern("(<*>) (<*>)", "p", "$2, $1")); alert("2 to the 64th is 18446744073709551616.".findPattern("#{3,}", "ol"));
Bookmarks