关卡地址

解决方案:

思路:

这一关同样不贴图了,直接看图片下提示:

One small letter, surrounded by EXACTLY three big bodyguards on each of its sides.

和上一关一样,需要从源代码中找到“一个两边完全被三个大写字母包围的小写字母”,这样的序列组成的字符串。

最后得到的是: linkedlist

访问 linkedlist.html 会提示你下一关地址是 linkedlist.php

代码:

Challenge003.py

import helper
msg=helper.readFile(".\\Data\\003\\msg.txt")

import re

# pattern=re.compile("[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]")


# matches=pattern.findall(msg)


# print(''.join(matches))


print(''.join(re.findall("[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]",msg)))
PS src\static> python .\Code\Python\Challenge003.py

Challenge003.ps1

$msg=(Get-Content ".\\Data\\003\\msg.txt" -Raw).Replace("`r`n","")

$pattern=[regex]"[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]"

$outstr=""
$pattern.Matches($msg) | foreach {$outstr += $_.Groups[1].Value}

Write-Output $outstr
PS src\static> .\Code\PowerShell\Challenge003.ps1

Challenge003.go

package main

import (
	"fmt"
	"regexp"
)

func (c *Challenge) Challenge003() {
	msg:=ReadFile(".\\Data\\003\\msg.txt")

	pattern:=regexp.MustCompile("[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]")

	// 返回一个二维数组
	matches:=pattern.FindAllStringSubmatch(msg,-1)

	outstr:=""
	for _,ch := range matches {
		outstr+=ch[1]
	}

	fmt.Println(outstr)
}
PS src\static> .\Code\Go\Challenge.exe -l 003

最终结果: linkedlist

[下一关地址][5]