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_descript ion,
payment_module. is_enabled,
configuration.c onfiguration_ke y,
configuration.c onfiguration_va lue,
configuration.s tore_id as `alias.storeid`
I'm looking to match only:
payment_module. module_descript ion
payment_module. is_enabled
configuration.c onfiguration_ke y
configuration.c onfiguration_va lue
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_descript ion
payment_module and is_enabled
configuration and configuration_k ey
configuration and configuration_v alue
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 1 3497
In article <11************ ***@www.vif.com >, Eric B.
<eb****@hotmail .com> 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_descript ion, payment_module. is_enabled, configuration.c onfiguration_ke y, configuration.c onfiguration_va lue, configuration.s tore_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 =----- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: hq4ever (at) 012 (dot) net (dot) il |
last post by:
function testemail($email) {
$validEmailExpr =
"^(?)*@(?)*$";
return eregi($validEmailExpr, $email);
}
$email = "foo@bar.gov.mil";
testmail($email); //return TRUE
|
by: John Smith |
last post by:
Hello,
I have a rather odd question. My company is an all java/oracle shop.
We do everything is Java... no matter what it is... parsing of text
files, messaging, gui you name it. My question is this... is Perl so
much better at parsing text files and outputing that we would see a
substantial speed increase? We process about 10 million records in
flat files a day for reformatting before putting them in a DB.
Also, when it comes to...
|
by: pekka niiranen |
last post by:
Hi there,
I have perl script that uses dynamically
constructed regular in this way:
------perl code starts ----
$result "";
$key = AAA\?01;
$key = quotemeta $key;
$line = " s^\?AAA\?01^BBB^g; #Comment "
|
by: Dieter Vanderelst |
last post by:
Dear all,
I'm currently comparing Python versus Perl to use in a project that
involved a lot of text processing. I'm trying to determine what the most
efficient language would be for our purposes. I have to admit that,
although I'm very familiar with Python, I'm complete Perl noob (and I
hope to stay one) which is reflected in my questions.
I know that the web offers a lot of resources on Python/Perl
differences. But I couldn't find a...
|
by: JohnSouth |
last post by:
Hi
I've been using a Regular expression to test for valid email addresses.
It looks like:
\w+(\w+)*@\w+(\w+)*\.\w+(\w+)*
I've now had 2 occassions where it has rejected and email address with
a "&" character in the local part. I know I should be able to work it
out myself, but I'd like to ask anyone to suggest the best way to
| |
by: yawnmoth |
last post by:
Say I have the following script:
<?
$string = 'test';
if (eregi("^+$",$string))
{
echo 'matches!';
}
else
{
|
by: John Nagle |
last post by:
Here's a large Perl regular expression, from a Perl address parser in CPAN:
use re 'eval';
$Addr_Match{street} = qr/
(?:
# special case for addresses like 100 South Street
(?:($Addr_Match{direct})\W+ (?{ $_{street} = $^N })
($Addr_Match{type})\b (?{ $_{type} = $^N }))
|
(?:($Addr_Match{direct})\W+ (?{ $_{prefix} = $^N }))?
|
by: negzero7 |
last post by:
Hi everyone,
I am trying to teach myself Perl with the aid of some books I have boughten. I'm doing some exercises with regular expressions but am having some trouble, specifically with this problem:
Write a program that prints only words (not the entire line) in the file part3.txt (attached) on a word boundary that have the letter "p" or "P" in them.
The Unix command line should look like:
$ proj2_3.pl part3.txt
|
by: William Gill |
last post by:
I am not to sharp on my regular expressions because I haven't used them
in quite a while. So I am relearning regex and the PHP regex functions
at the same time. Which means when I screw up, I'm not sure it's the
regular expression that's wrong or the specifics of the PHP function's
application thereof. I have a couple of questions, since I'm basically
starting from scratch should I focus on the ereg* functions instead of
the preg*...
|
by: Rene |
last post by:
I'm trying to basically remove chunks of html from a page but I must
not be doing my regular expression correctly.
What i'm trying with no avail.
$site = preg_replace("/<!DOCTYPE(.|\s)*<div class=\"notice_tan\">(.|
\s)*</div>/", "", $site);
I'm trying to remove from the very top to a specific div
Top of file:
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |