how do I do pattern matching for something like `/^(.*)text/` and `/text(.*)$/`?

Member Avatar
Member Avatar
+0 forum 1

Hello everyone. I am building a small database that will hold information about volunteers and their talents. I have created a search form, in which the user can enter a keyword and it will search the tables for any match. Currently I am using a criteria of: Like "*" & forms!SearchForm!Keywordtxt & "*". It all works great... my only issue is that when I type "Ch" in the keyword box instead of just getting words that start with "Ch" like China, chair, chocolate and such i get any word that has CH... like Chair, computer tech, Techno....etc. How can I …

Member Avatar
Member Avatar
+0 forum 4

List<? extends Integer> list = new ArrayList<Integer>(); for (Integer element : list) { System.out.println(element); List<? super Integer> list = new ArrayList<Integer>(); for (Integer element : list) { System.out.println(element); For the first three lines as Case 1 using extends it compiles fine. But for Case 2 of next three lines, it says incompatible types. Found Object, required Integer. My confusion is *? extends Integer* being **anything that is an Integer or sub of it** works. But why in Case 2 where *? super Integer* means **anything that is an Integer or a superclass of Integer** doesn't work when it's elements ar …

Member Avatar
Member Avatar
+0 forum 7

<? super Animal> means animal or it's superclass only. Then why inside the method it's allowing to add Dog object even though it's a subclass of Animal? This program compiles and runs! import java.util.*; class Cat {} class Animal{Animal() {System.out.println("Animal constructor");}} class Dog extends Animal{Dog() {System.out.println("Dog constructor");}} public class GenericDemo5 extends Animal{ public static void main(String r[]) { List l1 = new ArrayList(); //can add anything since no type here l1.add(new Dog()); l1.add(new Animal()); l1.add(30); met(l1); System.out.println(l1); } public static void met(List<? super Animal> l2) { l2.add(new Animal()); l2.add(new Dog()); System.out.println(l2); }} Even with Generic Instantiation(shown below) same output!! This …

Member Avatar
Member Avatar
+0 forum 11

import java.util.*; class SampleA { } class SampleB extends SampleA{ } class SampleC extends SampleA{ } class VectorDemo { public static void main(String r[]) { Vector<SampleA> v = new Vector<SampleA>(); v.add(new SampleB()); v.add(new SampleC()); SampleC rect = v.get(2); } } The output says "Incompatible types. Found SampleA, required SampleC. SampleC rect = v.get(2);" My doubt is first of all isn't this like using Wildcard where instead of saying Vector<? extends SampleA> v, we mentioned it a form of Vector<Type> v, which is one of the rules of Wild card which says if only <Type> is mentioned then it can accept …

Member Avatar
Member Avatar
+0 forum 3

Here slightly edited code from one of my earliest posts to DaniWeb. Limitted by recursion limit of Python as it uses recursion, but interesting for me.

Member Avatar
Member Avatar
+0 forum 2

Hello I'm not sure how this is possible but I want to enter a wildcard(?) into a php variable.. like this, <?php if($_SERVER['HTTP_HOST'] == '*.domain.com') { //do something } ?> Notice the * I basically need it to match if its any subdomain of domain.com Possible?

Member Avatar
Member Avatar
+0 forum 2

I am new to this forum. I need help in defining the same kind of function according to my requirements. as [url]http://www.codeproject.com/Articles/1088/Wildcard-string-compare-globbing[/url] I hope, I 'll get good response. Words are strings which are separated by dots. Two additional characters are also valid i.e:The *, which matches 1 word and the #, which matches 0..N words Example: *.stock.# matches the routing keys usd.stock and eur.stock.dsf but not stock.nasdaq. Your help would be highly appreciated. Sam

Member Avatar
Member Avatar
+0 forum 1

Hi I have a macro in excel that, creates an email in outlook. The issue I have is, this spreadsheet can be used by multiple people and I want their corresponding email signature in the email when they send it The signature code I have is : SigString = "C:\Documents and Settings\" & Environ("username") & _ "\Application Data\Microsoft\Signatures\ after the signatures path i need to do a wildcard that will pick up the users signature. I know the file I want ends in .htm can someone show me how i can use wildcard characters to pick up any users email …

Member Avatar
+0 forum 0

The sort methods for collections specifies that the parameter must be a collection of objects that implement Comparable for their own class or superclass, eg [CODE]public static <T extends Comparable<? super T>> void sort(List<T> list)[/CODE] Can anyone tell me how to define an ArrayList that will only accept such objects? I want to say [CODE]ArrayList<T extends Comparable<? super T>> eg = new ArrayList<String>();[/CODE] But that doesn't compile. I could use [CODE]ArrayList<? extends Comparable<?>> ok = new ArrayList<String>();[/CODE] but that's a bit too general (although the exceptions would be weird anyway). I know I'm going to look silly when someone points …

Member Avatar
Member Avatar
+0 forum 1

Consider the following code : [CODE]class R2<E> { E a; E get() { return a; } void set(E a) { this.a=a; } } class R3 { void doit(R2 a) // (1) { a.set(new Integer(5)); } }[/CODE] When I compile the file containing class R3, it rightly gives an unchecked warning because the compiler can't know for sure what was the element type of a (if any) i.e its a raw type. But if we replace (1) with : [CODE]void doit(R2<?> a)[/CODE] In this case, the compiler complains. My question is that the wildcard ? denotes all types, so it should …

Member Avatar
Member Avatar
+0 forum 5

Hi people, I'm trying to match strings from a pattern containing[B] wildcards[/B]. Basically I need to be able to go through a stack of strings, and see which of them matches my pattern. Fx [B]My*.txt[/B] will match only one of these. [U]MyFile.txt[/U] [I]MyFile.php[/I] I'm aiming to end up with a function like this, which returns all matching strings. [CODE]std::vector<std::string> matchStrings(const std::string& pattern, const std::vector<std::string>& stringsToMatch);[/CODE] I've been thinking a lot about this, and wrote many different codes to do this, but I cannot think of a way that works in all scenarios. I'd also like it to be efficient. If …

Member Avatar
Member Avatar
+0 forum 9

The End.