공인 IP 확인 URL : http://checkip.dyndns.org/
정규식 (TRegEx)을 이용하여 IP 정보를 추출하는 코드입니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
const PATTERN: String = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.' + '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.' + '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.' + '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'; var Matches: TMatchCollection; begin Matches := TRegEx.Matches('Current IP Address: 59.7.207.240', PATTERN); if Matches.Count > 0 then begin ShowMessage(Matches[0].Value); end; end; |