小编Joh*_*eYo的帖子

在Windows 7上获得Valgrind

我正在学习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)

c valgrind windows-7 mingw-w64

5
推荐指数
1
解决办法
2959
查看次数

正则表达式匹配 mm/dd/yyyy hh:mm:ss AM 或 PM

我有一个为时间戳创建信息的程序,时间戳必须符合以下格式: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)

ruby regex format time date

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

c ×1

date ×1

format ×1

mingw-w64 ×1

regex ×1

ruby ×1

time ×1

valgrind ×1

windows-7 ×1