我正在学习C并希望在我的系统上安装Valgrind,但是当我尝试安装Valgrin时,我得到一个错误,说Valgrind is OS specific. Sorry
我运行的是Windows 7,安装了Mingw64 GIT.我做了一些研究,发现了这一点.根据我需要运行sh ./configure --host x86_64 w64-mingw32
但是当我运行它时,我得到以下输出:
$ sh ./configure --host x86_64-w64-mingw32
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for x86_64-w64-mingw64-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether …
Run Code Online (Sandbox Code Playgroud) 我有一个为时间戳创建信息的程序,时间戳必须符合以下格式:MM/DD/YYYY HH:MM:SS AM or PM
例如:
06/02/2016 10:14:56 AM
09/14/2014 9:16:32 PM
我需要一种方法来使用更好的正则表达式来匹配此信息,但它不一定是正则表达式。任何对此的帮助将不胜感激。
我知道如何匹配数字/\d+/
, 和非空白字符,但是匹配数字不会抓住:
, /
, AM or PM
。抓取非空白区域将抓取除了明显空白区域之外的所有内容。
因此,回顾一下,我需要一种方法来验证格式化的时间和日期:MM/DD/YYYY HH:MM:SS AM or PM
可以包含 20 到 22 个字符(包括空格)存在或不作为用户输入给出。
我需要的示例:
def timestamp
print 'Enter the time stamp to verify: '
ts = gets.chomp
if !(ts[REGEX-HERE])
puts 'Invalid formatting of time stamp'
exit 1
else
puts ts
end
end
# <= 6/1/2016 1:10:5 PM will output '6/1/2016 1:10:5 PM'
# <= 06/01/2016 01:10:05 …
Run Code Online (Sandbox Code Playgroud)