[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Regular expression to find illegal ipv6 information

Posted on 2010-03-24
6
Medium Priority
?
604 Views
Last Modified: 2012-05-09
I do not know bash, but I am familiar with regex in perl.  I need a command like regex to find the following things within a bunch of text files:


1) domain.com without a trailing dot.   So the text files should have domain.com. in them but should NOT have domain.com (without trailing dot).  So I need to find any domain.com without the trailing dot.

2) I need to find any ipv6 reverse record node that is not formed correctly.  If it is formed correctly it will have 16 hex digitals seperated by a dot. (ex. 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0)

I would like to simply run grep -regex- * if possible.

Thanks
0
Comment
Question by:savone
  • 3
  • 2
5 Comments
 
LVL 35

Accepted Solution

by:
Terry Woods earned 1400 total points
ID: 28475098
1) grep --regexp="domain\\.com[^.]" *
0
 
LVL 35

Expert Comment

by:Terry Woods
ID: 28475299
2) You'll need to give some details as to what counts as being "not formed correctly" - if there's a line in a file containing "hello", do you want that picked up because you were expecting 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 instead? Or must there be, say, at least 10 . characters on the line before attention is paid to it?
0
 
LVL 23

Author Comment

by:savone
ID: 28545818
This question can be deleted.
0
 
LVL 35

Expert Comment

by:Terry Woods
ID: 28600326
I believe I gave a correct answer to at least the first part of question, so in my view, points should be awarded.
0
 
LVL 23

Author Comment

by:savone
ID: 28611954
I would agree with you if every domain was domain.com. unfortunately there are hundreds of domains non of which are domain.com. your regex would return none.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Batuhan Cetin Regular expression is a language that we use to edit a string or retrieve sub-strings that meets specific rules from a text. A regular expression can be applied to a set of string variables. There are many RegEx engines for u…
Whatever be the reason, if you are working on web development side,  you will need day-today validation codes like email validation, date validation , IP address validation, phone validation on any of the edit page or say at the time of registration…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question