Hi to all. I have one problem

I try to parse some string and get data from it. For example i have three strings "Greece about 2 weeks", "greece" and "grece about 500 eur"

Now i want to define regular expressions and check for right format. I need data like destination, city, duration, price

How can i get all this data from different strings. Some string has all information, some just one, for example just destination. How can i know what is price, what is destination and how can i get data with regex.

Regards
Thx

any idea how to make regex for his?

regards

to use regular expression to extract some data, you have to have a pattern, it is used for pattern matching. in your case what is the pattern in your strings?

Pattern for "Greece about 2 week": destination is greece, duration is about 2 weeks

Pattern for "greece": destination is greece

Pattern for "grece about 500 eur": destination is greece, price is about 500 eur

Is this what you mean?

Regards

IMHO You seem to think a computer can "think"!?!
YOU read "greece" and YOU think OK, that's a country!
Or YOU read "grece" and YOU think OK that's a typo, I understand, it's a country.
A computer does not "think" in that way let alone the fact it even can. E.g. http://www.cleverbot.com/ seems to simulate "thinking", but it is NOT.

yeah that is why he created another thread with the same name :)
we frustrated him :)

yes you really did. I see that my problem is really not so easy as i think it is :(

you try to create a robot which is able to understand meanings. it is a very hard thing to do.

I think that this is almost impossible to make. Robots are not human, they can learn but not so good as human...

Glad you came to that conclusion. In Star Trek computers can even repair whole spaceships! Computers are rather dumb really, they only do what WE tell them to do. No more no less.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.