Post by johnny_jiang 关于第5个小题,网络地址应该为9.80.0.0,按照要求是不是需要匹配如下的几段: 1. 9.80.1.15 ~ 9.80.255.255 2. 9.81.0.0 ~ 9.81.255.255 3. 9.82.0.0 ~ 9.82.255.255 4. 9.83.0.0 ~ 9.83.253.100
使用道具 举报
Post by jiazhengw 是的,我是从个位判断的,个位如果是0,则十位可以是[1-9],依此类推。如果从十位判断也可以,十位如果是9,则个位可以是[0-8],这样也可以。我觉得用这样的方法那如果是三位数那岂不是长得将人看晕了,呵呵!总觉得有简单的方法,但想不出。
Post by yongjian No many people are interested in those exams looks like... well here is what I did for the IP one: 1. /(([1-9]?[0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5]))\.){3}([1-9]?[0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5]))$/ [color=green]passed[/color] 2. A class: ([1-9][0-9]?|1[0-2][0-7])\.(([1-9]?[0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5]))\.){2}([1-9]?[0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5])) [color=red] echo 1.0.00.254 | egrep 'regexp' echo back echo 192.168.0.1 | egrep 'regexp' echo back not passed [/color] 3. B class: 1(2[89]|[3-8][0-9]|9[01])\.(([1-9]?[0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5]))\.){2}([1-9]?[0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5])) [color=red] echo 128.0.00.1 | egrep 'regexp' echo back not passed [/color] 4. C class: 19[2-9]|2([01][0-9]|2[0-3])\.(([1-9]?[0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5]))\.){2}([1-9]?[0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5])) [color=red] also 00 problem not passed [/color] 5. 9.80.1.15 - 9.83.253.100 的所有IP表达式(netmask = 255.252.0.0) 9\.8(0\.(1\.(1[5-9]|[2-9][0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5]))|([2-9]|[1-9][0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5])\.([1-9]?[0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5]))))|[12](\.([1-9]?[0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5]))){2}|3\.(([1-9]?[0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-2]))\.([1-9]?[0-9]|1[0-9]{2}|2([0-4][0-9]|5[0-5]))|253\.([1-9]?[0-9]|100))) [color=red] echo 9.81.0.256 | egrep 'regexp' echo back not passed [/color] 复制代码 Please check...
Post by yongjian This is how I did for the last special char matching. '[^\]*\\"t\\"[^\]*\\<user@domain\.com\\>[^\]*\\"b\\"\.' An easy one is like '\([^\]*\\\)*"\.' 复制代码
本版积分规则 发表回复 回帖后跳转到最后一页