Wild card or regular expression

S

sconeek

hi all,
i am trying to implement a functionality where the code searches for
anything, which matches a certain pattern. i have created the following
but am unable to zero in how to do it.

i have the following sentence,
fetchItemMain(this.aType().xxxx);

now i need to match which matches anything aType.whatever. now xxxx can
be anything.

can somebody suggest on how to go about it.

thanks
 
H

Hendrik Maryns

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message

(e-mail address removed) schreef:
hi all,
i am trying to implement a functionality where the code searches for
anything, which matches a certain pattern. i have created the following
but am unable to zero in how to do it.

i have the following sentence,
fetchItemMain(this.aType().xxxx);

now i need to match which matches anything aType.whatever. now xxxx can
be anything.

can somebody suggest on how to go about it.

Not if you give no more elaborate, less cryptic explanation.

What do you want? What did you try? What do you /really/ want?

H.
--
Hendrik Maryns

==================
www.lieverleven.be
http://aouw.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFEEXFVe+7xMGD3itQRAlZHAJ903RVXB6IhS2WnQMXdtb5vtCzm9ACdEPl9
go7u6J9OMvdFQ1WXGA4KT7s=
=zlQw
-----END PGP SIGNATURE-----
 
S

sconeek

I am performing a search within the DB. now i do not want to hardcode
the string, or use a linked list. i want to just say
fetchItemMain(this.aType()-------)

now i am not sure what goes in place of ------. so all i am saying is
give me all results which start with aType. but how should i do it
programmatically?

i hope this clarifies it.
 
?

=?ISO-8859-1?Q?Jan_Thom=E4?=

I am performing a search within the DB. now i do not want to hardcode
the string, or use a linked list. i want to just say
fetchItemMain(this.aType()-------)

now i am not sure what goes in place of ------. so all i am saying is
give me all results which start with aType. but how should i do it
programmatically?

i hope this clarifies it.
Hi,

actually not really. What do you mean by DB? Are you talking about SQL
statements here? Can you maybe provide a bigger code snippet so we can
get an idea what do you want to achieve?

Best regards,
Jan
 
H

Hendrik Maryns

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message

(e-mail address removed) schreef:
I am performing a search within the DB. now i do not want to hardcode
the string, or use a linked list. i want to just say
fetchItemMain(this.aType()-------)

now i am not sure what goes in place of ------. so all i am saying is
give me all results which start with aType. but how should i do it
programmatically?

i hope this clarifies it.

It doesn?t. See http://www.catb.org/~esr/faqs/smart-questions.html

Also interesting: http://mindprod.com/jgloss/newsgroups.html

H.

--
Hendrik Maryns

==================
www.lieverleven.be
http://aouw.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFEEYd3e+7xMGD3itQRAhdpAJ922HoKJQ7sGJIt36wC2w5bHJfOLwCeNRRo
Q8ymoxsXUS/U4x9gPMvGbVg=
=9L1L
-----END PGP SIGNATURE-----
 
T

tom fredriksen

I am performing a search within the DB. now i do not want to hardcode
the string, or use a linked list. i want to just say
fetchItemMain(this.aType()-------)

now i am not sure what goes in place of ------. so all i am saying is
give me all results which start with aType. but how should i do it
programmatically?

First lets try to understand what you want to do.

Normally I would interpret what you are saying as a mechanism to specify
with a sort of "pattern match" object with pattern values what you are
looking for, e.g.

getFromStorage( new anEmployee(name="?", salary>50000) )

Is this what you are thinking?

/tom
 
S

sconeek

ok. i hope this really clarfies it.
i have a postgres DB. my java code accesses this db. this table
contains a lot of records with field names. now i am trying to filter
data from within this table.
eg field name, name-lastname (mr-smith)
now i have a selected number of names, eg. mr,mrs,miss. so i have
specified these entries within a linkedlist.
so my current implementation is, fetchItemMain(linkedlist + "-" +
something);
but i want to replace linkedlist with "anything which starts with m".
so instead of running a loop x times based on the number of items
within my linkedlist, i want to say return anything which starts with
m.
i hope this helps. thanks.
 
T

tom fredriksen

ok. i hope this really clarfies it.
i have a postgres DB. my java code accesses this db. this table
contains a lot of records with field names. now i am trying to filter
data from within this table.
eg field name, name-lastname (mr-smith)
now i have a selected number of names, eg. mr,mrs,miss. so i have
specified these entries within a linkedlist.
so my current implementation is, fetchItemMain(linkedlist + "-" +
something);
but i want to replace linkedlist with "anything which starts with m".
so instead of running a loop x times based on the number of items
within my linkedlist, i want to say return anything which starts with
m.

Whats the problem? Postgres has support for regexp text searches, look
it up in online db documents. In any case, you need to construct the sql
statement with the correct regexp in your application, how you do that
is up to you. A linked list is as good as any for such a purpose, unless
you are able to somehow automagically detect what you need without
writing any code for it.

/tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top