Hi guys, my name is Jeffry. Can you help me to pattern used by the regex to do simple searching?
Assuming I have an ArrayList that contains movies title like this: Batman Batman Forever Batman Returns Batman Begins Batman, the Dark Knight //coming soon in July 2008
when I search with the word "bat", I want the movies title above are print in the screen to prove that the pattern is right as well as I search using the word "man" (if there is a title named "Superman", it will print too).
Thanks for your help. Currently I'm developing DVD Rental application in my thesis project.
Is there a particular reason you want to use regexps? It seems that this could be easily done using a couple of String.indexOf calls.
Nope, but if you have the solution with "a couple of String.indexOf calls" as you said, I'll take your solution. This is my own project, developed only by me and I only need simple searching like I posted before.
Jeffry Kristianto Yanuar.
Joined: Mar 22, 2005
Instead of just giving out solutions, we prefer to lead people to them. You could iterate through the List, and check indexOf("bat") and indexOf("man") to each element of it. You probably want to lowercase the array elements before calling indexOf to make sure you find "Man" as well as "man".