In article <>, Eric B.
<> wrote:
> Hi,
>
> I'm hoping someone can help me come up with a regular expression that I need
> to match the following.
>
> I'm looking to match all occurances of format <word>.<word> in a string that
> is not followed by the words AS. This is coming from an SQL select
> statement.
>
>
> Select
> payment_module.module_name as `alias.name`,
> payment_module.module_description,
> payment_module.is_enabled,
> configuration.configuration_key,
> configuration.configuration_value,
> configuration.store_id as `alias.storeid`
>
> Any help would be greatly appreciated. So far I've managed to come up with:
> /(?<!as )(?>([A-Z0-9_-]*)\.([A-Z0-9_-]*))(?![ ]+as[ ]+[A-Z0-9_\-.]+)/i
>
> but that doesn't seem to work as it sees the expression alias.name as not
> being preceeded by "as ".
Unaliased table.column names are followed directly by a comma (at least
in all of your examples), so you can use:
/([\-\w]+)\.([\-\w]+)\s*,/ig
Note the following:
1. you need the 'g' modifier to catch all occurrences on a line.
2. the \w character class is equivalent to [a-zA-Z_0-9]
3. you need to escape '-' to use it as is in a character class (2
occurrences in your reqex do not).
-----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------
http://www.newsfeed.com The #1 Newsgroup Service in the World!
-----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----