小编Lam*_*mnk的帖子

正则表达式类型之间的差异

我正在阅读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

regex syntax posix find

12
推荐指数
1
解决办法
8085
查看次数

PostgreSQL不接受WHERE子句中的列别名

在这种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)

为什么我不能在子句costSELECT …

sql postgresql alias operator-precedence

10
推荐指数
1
解决办法
5627
查看次数

在Ruby中将类似模式的字符串分组

我有一个文件名数组.这些的子集可能具有类似的模式(字母表末尾带有数字的字符串):

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)

ruby arrays string algorithm

3
推荐指数
1
解决办法
1409
查看次数

标签 统计

algorithm ×1

alias ×1

arrays ×1

find ×1

operator-precedence ×1

posix ×1

postgresql ×1

regex ×1

ruby ×1

sql ×1

string ×1

syntax ×1