E
Eric B.
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.
Basically, I'm looking to match all the field names in an SQL select
statement that are not being aliased.
For example, in the following 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`
I'm looking to match only:
payment_module.module_description
payment_module.is_enabled
configuration.configuration_key
configuration.configuration_value
Ideally, am looking for an expression using subexpressions that further
seperate the table name from the field name in this select statement:
ie: payment_module and module_description
payment_module and is_enabled
configuration and configuration_key
configuration and configuration_value
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 ".
Thanks!
Eric
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.
Basically, I'm looking to match all the field names in an SQL select
statement that are not being aliased.
For example, in the following 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`
I'm looking to match only:
payment_module.module_description
payment_module.is_enabled
configuration.configuration_key
configuration.configuration_value
Ideally, am looking for an expression using subexpressions that further
seperate the table name from the field name in this select statement:
ie: payment_module and module_description
payment_module and is_enabled
configuration and configuration_key
configuration and configuration_value
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 ".
Thanks!
Eric