rgxextract() in a query to extract any one of many possibilities

G

Guest

I am using access 2003.

rgxExtract() from
http://www.j.nurick.dial.pipex.com/Code/vbRegex/rgxExtract.htm#Code
has helped me solve a problem partially but if anyone can tell me how to get
rgxextract() to find in a text Field "this or that or the other"

heres whats going on; I am pasting information into a Field, and rgxextract
in a query looks through the data that can be in any order to find what I ask
it to.

However the data doesn't cooperate as easily. for example the pasted data
will read "a cute 3bdr house for rent" and the following will extract the
data of 3bdr for me...... rgxExtract([paste row]," 3bdr")...... Unfortunately
if the ad reads with a slight variation of "a cute 3 bd house for rent" or "
a cute 3 bed for rent" or "a cute 2 bd house for rent" as you can see people
have a different way of describing the information regarding how many
bedrooms the house has.

I tried variations of rgxextract. for example I tried; rgxExtract([paste
row],"3bdr","2 bdr","3 bed","3 bd","3bd")

I did this in hopes that rgx would look for all of those values and bring
back which one it found.

If I can't do this then I will need to make several new Fields in the query
to represent every possibility, then make another Field that will put them
all together and show me the results.

BTW I am using query to do this operation because of my limited VBA
knowledge


Thank you, for your consideration, Dave
 
D

Douglas J. Steele

You're going to have to learn more about Regular Expressions, and pass the
correct expression to the function. Unfortunately, I'm not that up on
regular expressions myself, but I think a pattern of "\d ?bdr" should accept
any digit followed by an optional space followed by the letters bdr, so that
it would find 1 bdr, 2bdr, 3 bdr, 3bdr etc.

http://www.regular-expressions.info/ looks like a good place to start.
 
G

Guest

Thank you Douglas,

That is most of the way there! The change you suggested does extract 1 or
2 or 3 or any number even if there is a space in between or not, I guess for
the other abreviations I can make a new field for each of the different ways
to abreviate bedroom, "\d ?bd" and "\d ?bed" and any others I learn of,
then have another field look at all those fields to find and display the one
that was found.

thank you,
Dave


Douglas J. Steele said:
You're going to have to learn more about Regular Expressions, and pass the
correct expression to the function. Unfortunately, I'm not that up on
regular expressions myself, but I think a pattern of "\d ?bdr" should accept
any digit followed by an optional space followed by the letters bdr, so that
it would find 1 bdr, 2bdr, 3 bdr, 3bdr etc.

http://www.regular-expressions.info/ looks like a good place to start.



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Dave Sponseller said:
I am using access 2003.

rgxExtract() from
http://www.j.nurick.dial.pipex.com/Code/vbRegex/rgxExtract.htm#Code
has helped me solve a problem partially but if anyone can tell me how to
get
rgxextract() to find in a text Field "this or that or the other"

heres whats going on; I am pasting information into a Field, and
rgxextract
in a query looks through the data that can be in any order to find what I
ask
it to.

However the data doesn't cooperate as easily. for example the pasted data
will read "a cute 3bdr house for rent" and the following will extract the
data of 3bdr for me...... rgxExtract([paste row]," 3bdr")......
Unfortunately
if the ad reads with a slight variation of "a cute 3 bd house for rent" or
"
a cute 3 bed for rent" or "a cute 2 bd house for rent" as you can see
people
have a different way of describing the information regarding how many
bedrooms the house has.

I tried variations of rgxextract. for example I tried; rgxExtract([paste
row],"3bdr","2 bdr","3 bed","3 bd","3bd")

I did this in hopes that rgx would look for all of those values and bring
back which one it found.

If I can't do this then I will need to make several new Fields in the
query
to represent every possibility, then make another Field that will put them
all together and show me the results.

BTW I am using query to do this operation because of my limited VBA
knowledge


Thank you, for your consideration, Dave
 

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

Top