我正在阅读GNU find的手册页并绊倒这个开关:
-regextype type
Changes the regular expression syntax understood by -regex and
-iregex tests which occur later on the command line. Currently-
implemented types are emacs (this is the default), posix-awk, posix-
basic, posix-egrep and posix-extended.
Run Code Online (Sandbox Code Playgroud)
这些正则表达式语法之间有什么区别?我对Ruby的正则表达式更熟悉,那么我应该使用什么类型的正则表达式find?
在这种pgexercises有关加入3页不同的表,给出的答案是如下:
select mems.firstname || ' ' || mems.surname as member,
facs.name as facility,
case
when mems.memid = 0 then
bks.slots*facs.guestcost
else
bks.slots*facs.membercost
end as cost
from
cd.members mems
inner join cd.bookings bks
on mems.memid = bks.memid
inner join cd.facilities facs
on bks.facid = facs.facid
where
bks.starttime >= '2012-09-14' and
bks.starttime < '2012-09-15' and (
(mems.memid = 0 and bks.slots*facs.guestcost > 30) or
(mems.memid != 0 and bks.slots*facs.membercost > 30)
)
order by cost desc;
Run Code Online (Sandbox Code Playgroud)
为什么我不能在子句cost的SELECT …
我有一个文件名数组.这些的子集可能具有类似的模式(字母表末尾带有数字的字符串):
arr = %w[
WordWord1.html
WordWord3.html
WordWord10.html
WordWord11.html
AnotherWord1.html
AnotherWord2.html
FileFile.html
]
Run Code Online (Sandbox Code Playgroud)
如何识别相似的子串(它们具有相同的子串,只是它们的数字不同)并将它们移动到一个数组?
['WordWord1.html', 'WordWord3.html', 'WordWord10.html', 'WordWord11.html']
['AnotherWord1.html', 'AnotherWord2.html']
['FileFile.html']
Run Code Online (Sandbox Code Playgroud)