in reply to TNSNAMES.ORA and Recdescent
You said that "It will mistake an IP address like 199.92.100.35.100 as a valid IP." The code I'm looking at that you wrote is like this:
IP : /[0-9]+.[0-9]+.[0-9]+.[0-9]/
I have to assume that the part there which looks like an RE is, indeed, a Perl-like regular expression. That being the case, your first problem is that "." has special meaning in an RE: It matches anything except the newline character. So [0-9]+. means match one or more numeric digits followed by any character. Well, that's probably not what you really want. So at minimum, escape those dot characters within the RE: [0-9]+\.
The next thing is that your RE isn't rejecting items that contain MORE than what you're trying to match. The Owls book (O'Reilly: Mastering Regular Expressions, by Friedl) presents the following regexp for matching IP addresses:
/^([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]? +\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])$/
Note: I added the $ to the end of the RE so that you're not passing strings that contain anything after the IP address. That may or may not be necessary in your case. Hopefully that will be robust enough to help.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: TNSNAMES.ORA and Recdescent
by paulbort (Hermit) on Feb 19, 2004 at 23:12 UTC | |
by iburrell (Chaplain) on Feb 20, 2004 at 06:13 UTC | |
by merlyn (Sage) on Feb 23, 2004 at 18:43 UTC | |
by jmr4096 (Acolyte) on Feb 23, 2004 at 19:39 UTC |