51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2462|回复: 1
打印 上一主题 下一主题

[原创] 讨教一个关于“正则表达式”的问题

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2006-11-24 11:29:20 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
1、正则表达式的作用?
2、比如:在用户手册中,可以在属性值和检查点中使用。但是在属性值中,比如一个录制过程:提交一个表单操作,输入数据,点击“提交”按钮,如表单数据不完整,返回表单给用户,用户输入完整的数据,点击“重新提交”按钮,把这个按钮的“名字”属性修改为正则表达式。
      这个过程我都录制下来了,有必要把属性改为正则表达式吗?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

  • TA的每日心情
    难过
    2015-4-23 14:35
  • 签到天数: 3 天

    连续签到: 1 天

    [LV.2]测试排长

    2#
    发表于 2006-11-24 11:48:35 | 只看该作者
    In a typical search and replace operation, you must provide the exact text you are looking for. That technique may be adequate for simple search and replace tasks in static text, but it lacks flexibility and makes searching dynamic text difficult, if not impossible.

    With regular expressions, you can:

    Test for a pattern within a string. For example, you can test an input string to see if a telephone number pattern or a credit card number pattern occurs within the string. This is called data validation.
    Replace text. You can use a regular expression to identify specific text in a document and either remove it completely or replace it with other text.
    Extract a substring from a string based upon a pattern match. You can find specific text within a document or input field
    For example, if you need to search an entire web site to remove some outdated material and replace some HTML formatting tags, you can use a regular expression to test each file to see if the material or the HTML formatting tags you are looking for exists in that file. That way, you can narrow down the affected files to only those that contain the material that has to be removed or changed. You can then use a regular expression to remove the outdated material, and finally, you can use regular expressions to search for and replace the tags that need replacing.

    Another example of where a regular expression is useful occurs in a language that isn't known for its string-handling ability. VBScript, a subset of Visual Basic, has a rich set of string-handling functions. JScript, like C, does not. Regular expressions provide a significant improvement in string-handling for JScript. However, regular expressions may also be more efficient to use in VBScript as well, allowing you do perform multiple string manipulations in a single expression.
    具体请看帮助文档
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-11-26 19:54 , Processed in 0.072027 second(s), 26 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表