topics

全部话题 - 话题: regexp
1 2 3 末页 (共3页)
z****n
发帖数: 79
1
说, “7 Dey St 14th Fl,\nNew York,\nNY 10007 " , 如何把里面的"NY" 给extract
出来?
可不可以用regexp 来写?要如何写? 还有什么简单干净的方法?
多谢。

i did this, not working,
matchObj = re.search(r"", eachLine)

if matchObj:
print matchObj.group(3)
Many thanks !
w*s
发帖数: 7227
2
来自主题: Linux版 - python regexp question (转载)
【 以下文字转载自 Programming 讨论区 】
发信人: wds (中原一点红:心开运就通,运通福就来), 信区: Programming
标 题: python regexp question
发信站: BBS 未名空间站 (Sat Jan 4 19:47:38 2014, 美东)
for a line like this, how to get ABT ?
http://www.nyse.com/about/listed/lcddata.html?ticker=abt">ABT*
b*****n
发帖数: 2324
3
来自主题: Military版 - est









x*p
发帖数: 4
9
来自主题: Java版 - Re: Regular Expression in Java

Got it. There is regexp package at
http://jakarta.apache.org/regexp/
x*z
发帖数: 1010
10
来自主题: Linux版 - Python问题请教
对啊,就是在请教这个regexp怎么写啊。按我的想法就得
两步,第一步先regexp去match [],然后再处理剩下的,
不过我python很弱,所以问问有没有什么好办法。
x*z
发帖数: 1010
11
来自主题: Linux版 - Python问题请教
嗯,谢谢,这也是一个思路,不过这个regexp有个小问题,唯一的判定点是要求'.',
这个不是一定的,比如'foo',我也需要它。如果把‘r"\." #dot’从re里拿掉,整个
regexp就不成立了。
e*******o
发帖数: 4654
12
来自主题: Programming版 - 大家最近学啥呢
二爷的帖子就像一朵鲜花盛开在牛粪堆上。
我们的一个test 跑不过了,我追踪到了perl的一个parsing module, Regexp::
Grammars
https://metacpan.org/pod/Regexp::Grammars
这花两天时间复习了一下,把bug 挑了出来,然后汇报给作者(Perl 大牛)。他当天就
给fix了。
准备把parse 好好搞一下。 二爷有没有啥推荐?
g******s
发帖数: 733
13
https://sourceforge.net/projects/matlab2fmex/
每次我都得到出错信息
Undefined function or variable 'regexp'.
Error in ==> h:\matlab2fmex\matlab2fmex\findstrexact.m
这个regexp什么地方都没有阿。有谁用过吗?先谢了!
n*****t
发帖数: 22014
14
来自主题: Military版 - 总有不少老夫喜欢瞎喷六四
实话实说,我这人真有洁癖。这洁癖倒不是见不到排泄系统,是对语言文字的规范要求
,俗称文青冰,或者深井冰。
举个例子,我下载 txt 小说,第一件事就是重新排版分段落,然后 regexp 删除广告
、三链
a****r
发帖数: 12375
15
来自主题: Military版 - 总有不少老夫喜欢瞎喷六四
这是典型的上海男人,前戏做得一丝不苟,到真枪实干的时候就滑精了。

实话实说,我这人真有洁癖。这洁癖倒不是见不到排泄系统,是对语言文字的规范要求
,俗称文青冰,或者深井冰。
举个例子,我下载 txt 小说,第一件事就是重新排版分段落,然后 regexp 删除广告
、三链
n****j
发帖数: 1708
16
这通稿早写好了,只不过每次出事的时候拿出来 regexp replace 一下
n*****t
发帖数: 22014
17
来自主题: Military版 - baidu alibaba宣布暂时停止招人
中文需要分词,regexp 搞不定
l**********9
发帖数: 537
18
来自主题: JobHunting版 - 问一个Java regexp的题
请教一下,这个打印什么:
System.out.println("Java".replaceAll("\w*", "RX"));
为什么是2个RX,而不是一个RX, 谢了
y****n
发帖数: 192
19
来自主题: JobHunting版 - 问一个Java regexp的题
should be "\\w*"
l**********9
发帖数: 537
20
来自主题: JobHunting版 - 问一个Java regexp的题
yes, it is \w*
System.out.println("Java".replaceAll("\w*", "RX"));
l**********9
发帖数: 537
21
来自主题: JobHunting版 - 问一个Java regexp的题
mitbbs 没做\符号的处理,需要打"\\"才出"\"
s*********l
发帖数: 103
22

Regular Expressions
Java, C#, Python, Perl have built-in support for regular expressions.
For C/C++ users, there are POSIX C API's for manipulating regular
expressions and the Boost.Regex library from boost.
http://www.boost.org/doc/libs/release/libs/regex
http://onlamp.com/pub/a/onlamp/2006/04/06/boostregex.html
Regular expression matching can be implemented using finite automata.
http://swtch.com/~rsc/regexp/
collects resources about implementing regular expression search efficiently
r**u
发帖数: 1567
23
来自主题: JobHunting版 - grep + perl regular expr (转载)
【 以下文字转载自 Linux 讨论区 】
发信人: raou (raou), 信区: Linux
标 题: grep + perl regular expr
发信站: BBS 未名空间站 (Thu Feb 25 16:08:55 2010, 美东)
想用grep+perl regular expression在文件里找一些东西,但是遇到这个问题。如何解
决?多谢
grep: Support for the -P option is not compiled into this --disable-perl-
regexp binary
D****6
发帖数: 278
24
来自主题: JobHunting版 - Amazon 三次电面面筋
第一次:
why Amazon
why good fit
find the min in an array. (coding, read to him)
find the first k smallest in an array.
how to implement arraylist
explain consistent hashing, what is the disadvantage
sth about how to grep some information from a log file, don't remember
details
第二次:
design a generic tree API
design html classes. how to use the tree API to create html tree
regexp to grep phone numbers from files
what is overwriting, overloading, inheritance, delegation, interface
what needs improveme
j******4
发帖数: 116
25
来自主题: JobHunting版 - regex matching algorithm
不一样啊不一样。。。再看看书?
regex 这个,网上有个很好的解,好像是在那个很慢的dr. dubb站上。
刚搜啦一下找不到拉。但是很适合interview.
一般解这个可以借鉴:http://swtch.com/~rsc/regexp/regexp1.html 理解啦以后写下来也不难。不过这个文章大方向好像是错的。wiki 的解释比较中肯。。
s*********b
发帖数: 815
26
来自主题: JobHunting版 - 老书还是得读呐
俺说的是K&R C那本。读了那本,写个简单的regular expression matcher
就是小事鸟,哪怕你对automata或者这篇文章一无所知:http://swtch.com/~rsc/regexp/regexp1.html
r********g
发帖数: 1351
27
来自主题: JobHunting版 - 说几个最近的面试题吧,G家的
有的是我面的,有的是听来的。。。detail我也不知道(或者没弄明白),大家自由发
挥吧。。
最讨厌的是开放题,实在无从下手(如果事先没准备的话)
1. 数据结构for spreadsheet
2. 实现 G+ search
3. 一个app需要用cache,怎么实现thread safe
老题:
找minimum snippet (这个很诡异,据说它家的答案是把每个character的index找出来)。
找regexp (含有*和.两个特殊字符,这个递归吧?)
d*******n
发帖数: 124
28
我想找一个google search offline的工具,可以基于keyword search 我的document。
可是google desktop discontinue了,还有没有alternative呢。
P.S.不是类似document内部和eclipse内部的那种基于keyword或regexp的search,因为
那些都是hard match而不是soft match。 By soft match, I mean using LCS.
l*n
发帖数: 529
29
csv要么用apache的csv库,要么就直接regexp吧。
r****x
发帖数: 3613
30
来自主题: WaterWorld版 - 借人气问个SAS的问题
have you tried regexp?
r****x
发帖数: 3613
31
来自主题: WaterWorld版 - 借人气问个SAS的问题

easier than regexp
s*****i
发帖数: 3762
32
来自主题: Joke版 - 和所有马工共勉
老卡,不要拿这么简单的regexp来哄骗小盆友啊
n*****t
发帖数: 22014
33
好像是手贱从 5 升到 6 还是 7,注册码不好使了,当时正好在做有点沾边的玩意,这
种 regexp 的东西程序搞搞更方便
l**n
发帖数: 7272
34
来自主题: Apple版 - Unix的缺陷(ZT)
虽然这里的码工比较少,但是能appreciate coding和programming的朋友也可以看看。
我觉得挺有意思的。
http://blog.sina.com.cn/s/blog_5d90e82f01014k5j.html
我想通过这篇文章解释一下我对 Unix 哲学本质的理解。我虽然指出 Unix 的一个设计
问题,但目的并不是打击人们对 Unix 的兴趣。虽然 Unix 在基础概念上有一个挺严重
的问题,但是经过多年的发展之后,这个问题恐怕已经被各种别的因素所弥补(比如大
量的人力)。但是如果开始正视这个问题,我们也许就可以缓慢的改善系统的结构,从
而使得它用起来更加高效,方便和安全,那又未尝不可。同时也希望这里对 Unix 命令
本质的阐述能帮助人迅速的掌握 Unix,灵活的应用它的潜力,避免它的缺点。
通常所说的“Unix哲学”包括以下三条原则[Mcllroy]:
一个程序只做一件事情,并且把它做好。
程序之间能够协同工作。
程序处理文本流,因为它是一个通用的接口。
这三条原则当中,前两条其实早于 Unix 就已经存在,它们描述的其实是程序设计最... 阅读全帖
t*******d
发帖数: 1530
35
来自主题: BuildingWeb版 - 贡献一个email validator RegExp
you can use this one for frontend email string validation using javascript,
or backend using asp. php, jsp... whatever.
have tried and worked good so far. feel free to use it and if you find some
error, please tell me.
^([a-zA-Z0-9_&+\/\\-])+([a-zA-Z0-9_&+\/\\\.-])*@([a-zA-Z0-9]([a-zA-Z0-9-]?[a
-zA-Z0-9])*\.)*([a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]\.)+[a-zA-Z0-9][a-zA-Z0-9
-]*[a-zA-Z0-9]$
t*********s
发帖数: 5
36
来自主题: BuildingWeb版 - 贡献一个email validator RegExp

,
some
[a
-9
Don't think you can use this to filter out all email address..
check this page:
http://www.unix.org.ua/orelly/perl/cookbook/ch06_20.htm
Besides, there are many inefficient stuff in your regex pattern.
i.e. in ([a-zA-Z0-9_&+\/\\-])+ , the capturing parenthesis are
not necessary. when matching, that ([...])+ construct makes your
regex engine constantly jump into and then jump out from the
capturing parens, that takes too much unnecessary work and is
highly not recommended. [..]+ is f
t*******d
发帖数: 1530
37
来自主题: BuildingWeb版 - 贡献一个email validator RegExp
http://s146030451.onlinehome.us/test.htm
Thanks. Good advice. I will optimize it once i am sure it is working.
I have post it to http://s146030451.onlinehome.us/test.htm
anyone can give it a test and let me know if I miss anything?
t*********s
发帖数: 5
38
来自主题: BuildingWeb版 - 贡献一个email validator RegExp

,
some
Some of my comments on your pattern:
this sub-pattern tells me that the username:
1) can be alphanumeric, any of the following grahpic
chars: _ & + / \ - .
2) must not be empty
3) must not begin with the dot '.'
The following is enough for that purpose:
[a-zA-Z0-9_&+\/\\-][a-zA-Z0-9_&+\/\\\.-]*
or if the engine supports look-around constructs:
(?!\.)[a-zA-Z0-9_&+\/\\\.-]+
Looks like the name of the hosts follows the following rules:
1) formed by alphanumberics, dot or dash
2) if
t*******d
发帖数: 1530
39
来自主题: BuildingWeb版 - 贡献一个email validator RegExp
Cant tell how much I appreciate your knowledgeable input.
I have modified the pattern to as follows (with # denoting a-zA-Z0-9)
^[#_&+\/-](\.?[#_&+\/-])*@([#][#-]{0,24}[#]\.)+[#]{2,}$
http://s146030451.onlinehome.us/test.htm
use it to test the emails you provided, i think it will rule out those bad
apples
12@google
1*[email protected]
.*[email protected]
[email protected]
[email protected]
[email protected]
[email protected]*m
1j@googl_e.com
/\@google.com
1+j/5*[email protected]
These three are good
[email protected]
1j@goo--
L****i
发帖数: 94
40
来自主题: BuildingWeb版 - 贡献一个email validator RegExp
我也来贡献一个:
^[A-Za-z0-9._-]+@[A-Za-z0-9._-]+\.(?:[A-Za-z]{2}|COM|ORG|MIL|NET|BIZ|INFO|
NAME|AERO|BIZ|INFO|JOBS|MUSEUM|NAME|com|org|mil|net|biz|info|name|aero|biz|
info|jobs|museum|name)$
t*******d
发帖数: 1530
41
来自主题: BuildingWeb版 - 贡献一个email validator RegExp
cases that your code fails:
&test/u**[email protected], which is legal.
[email protected], which is illegal.
s****y
发帖数: 983
42
来自主题: BuildingWeb版 - 请教个php mysql表格搜索问题
没有,用证则吧
WHERE ### REGEXP '^[[:digit:]]+$'
d******8
发帖数: 2191
43
来自主题: BuildingWeb版 - jquery的奇怪问题,alert不出现
String.prototype.is_email=function (){
var reg=new RegExp(/^[a-z][a-z0-9_.]*@([a-z0-9]*.)+[a-z0-9]+/i);
return reg.test(this);
};
$(document).ready(function(e){
$("input.email_input").change( function(e){
if($(this).val().is_email()){
alert('yes');////此处alert在输入正确的email后不出现
$(this).data("valid",true);
}
else $(this).data("valid",false);
});
})
阅读全帖
l******t
发帖数: 108
44

don't like to compile frequently.
i still think it is great to have auctex+reftex combo:
* regexp search for references, mark the ones that i wanted, and add
keys into \cite{}.
* when cursor being moved to a citation key, mini buffer shows a brief
info. about the entry.
...
to be completed :)
x******t
发帖数: 6
45
来自主题: CS版 - 用LTL能表达(a b)*吗?
查了篇文章Loop-Free Alternating Finite Automata,清楚了。
LTL的表达能力与star-free regular expression相同。所谓的“star-free的regexp语
言”虽然不含有*,却包含negation和intersection,因此它可以表达某些无限长的串。
B*****g
发帖数: 34098
B*****g
发帖数: 34098
47
来自主题: Database版 - SQL里如何做regular expession 的match?
你用啥sql? And why you need Regular Expression for date?
http://www.psoug.org/reference/regexp.html.

下?谢谢
B*****g
发帖数: 34098
48
来自主题: Database版 - date format转换问题请教
可惜不是oracle,要不也许可以用regExp
x*********n
发帖数: 28013
49
来自主题: EmergingNetworking版 - PIX真难用啊。
连个sh int ip bri都没有?
打出来居然是个提示符,说要你用pipe,然后grep regexp。。。
我晕倒了,还以为是linux玩管理呢。。
s*****g
发帖数: 1055
50
来自主题: EmergingNetworking版 - 眼下的工作太累,耗尽时间精力
No, it won't work, regexp ^31969$ won't match as-path with multiple 31969 in
it, you probably need a combination of filter-list and prefix-list in this
case, something like ^31969_[31969]*$ and only allow legitimate prefixes to
come in from this AS.
So a side question, does anybody here have tier-1 ISP operation experience?
how does a typical tier-1 ISP configure their BGP filters to block illegal
advertisement from a peer or a customer? do they participate RPKI? if so,
dothey use some kind of ... 阅读全帖
1 2 3 末页 (共3页)