我有一个MYSQL查询,试图用连字符查找单词。我正在使用MYSQL单词边界。
SELECT COUNT(id)
AS count
FROM table
WHERE (name REGEXP '^[[<:]]some-words-with-hyphens[[:>:]]/')
这似乎是可行的,尽管下面的内容并不是(参见单词“连字符”后面的-)
SELECT COUNT(id)
AS count
FROM table
WHERE (words REGEXP '^[[<:]]some-words-with-hyphens-[[:>:]]/
这是git show -s HEAD输出
smilyface@smilingface /d/workspace/shirt (develop)
$ git show -s HEAD
commit f601411d4be3c3fbafea79c72ecc84ad78219265
Author: Smily Face <v-smily@somedomaingoeshere.com>
Date: Wed May 29 15:22:45 2019 +0530
Ticket-249843 : [shirt team apps] Deprecation of x function
所以我有一个字符串,我需要解析。该字符串包含多个单词,用连字符(-)分隔。字符串也以连字符结尾。
例如,one-two-three-。
现在,如果我想单独查看这些单词,我会将字符串拆分成一个列表。
wordstring = "one-two-three-"
wordlist = wordstring.split('-')
for i in range(0, len(wordlist)):
print(wordlist[i])
输出
one
two
three
#empty element
我不明白的是,为什么在结果列表中,最后一个元素是一个空字符串。
在Jenkinsfile中的一个步骤中,我有以下语句
steps {
sh '''
file=/sql/common/file1.sql
echo $file
if ["$file" = *"/common"* ]; then
echo "changes found in common directory "
fi
'''
}
由于某些原因,shell在jenkinsfile中不能正常工作。我们如何在Jenkinsfile中比较shell中的字符串?对于这些,我们有什么特定的语法吗?如果我使用
我希望使用在Jenkinsfile脚本中使用的变量,然后将其值传递到shell脚本执行中(作为环境变量或命令行参数)。
但是下面的Jenkinsfile
for (i in [ 'a', 'b', 'c' ]) {
echo i
sh 'echo "from shell i=$i"'
}
给出输出:
a
from shell i=
b
from shell i=
c
from shell i=
期望的输出类似于:
a
from shell i=a
b
from shell i=b
c
from sh
我正在尝试理解strip()函数。我看到一种令人困惑的行为。
import sys
test = input().strip('e')
print(test)
N = input().strip('cmowz.')
print(N)
print('www.example.com'.strip('cmowz.'))
这提供了以下输出:
test message here
'www.example.com'
example
所以,我看到的是,调用input().strip()方法对于尾随和前导空间是正确