正则表达式

西门子S7-1200与汇川SV660P伺服速度模式实战:从接线到编程全流程 本文详细解析了西门子S7-1200 PLC与汇川SV660P伺服驱动器在速度模式下的集成实战。内容涵盖从硬件接线、伺服参数关键设置(如电子齿轮比)、博图软件组态到PLC编程的全流程,并提供了故障排查与性能优化指南,帮助工程师快速实现精准、稳定的运动控制。 阅读详情

第一部分:
-----------------
正则表达式(REs)通常被错误地认为是只有少数人理解的一种神秘语言。在表面上它们确实看起来杂乱无章,如果你不知道它的语法,那么它的代码在你眼里只是一堆文字垃圾而已。实际上,正则表达式是非常简单并且可以被理解。读完这篇文章后,你将会通晓正则表达式的通用语法。

支持多种平台


正则表达式最早是由数学家Stephen Kleene于1956年提出,他是在对自然语言的递增研究成果的基础上提出来的。具有完整语法的正则表达式使用在字符的格式匹配方面上,后来被应用到熔融信息技术领域。自从那时起,正则表达式经过几个时期的发展,现在的标准已经被ISO(国际标准组织)批准和被Open Group组织认定。

正则表达式并非一门专用语言,但它可用于在一个文件或字符里查找和替代文本的一种标准。它具有两种标准:基本的正则表达式(BRE),扩展的正则表达式(ERE)。ERE包括BRE功能和另外其它的概念。

许多程序中都使用了正则表达式,包括xsh,egrep,sed,vi以及在UNIX平台下的程序。它们可以被很多语言采纳,如HTML 和XML,这些采纳通常只是整个标准的一个子集。

比你想象的还要普通
随着正则表达式移植到交叉平台的程序语言的发展,这的功能也日益完整,使用也逐渐广泛。网络上的搜索引擎使用它,e-mail程序也使用它,即使你不是一个UNIX程序员,你也可以使用规则语言来简化你的程序而缩短你的开发时间。

正则表达式101
很多正则表达式的语法看起来很相似,这是因为你以前你没有研究过它们。通配符是RE的一个结构类型,即重复操作。让我们先看一看ERE标准的最通用的基本语法类型。为了能够提供具有特定用途的范例,我将使用几个不同的程序。

第二部分:
----------------------
字符匹配

正则表达式的关键之处在于确定你要搜索匹配的东西,如果没有这一概念,Res将毫无用处。

每一个表达式都包含需要查找的指令,如表A所示。

Table A: Character-matching regular expressions
格式说明:
---------------
操作:
解释:
例子:
结果:
----------------
.
Match any one character
grep .ord sample.txt
Will match “ford”, “lord”, “2ord”, etc. in the file sample.txt.
-----------------
[ ]
Match any one character listed between the brackets
grep [cng]ord sample.txt
Will match only “cord”, “nord”, and “gord”
---------------------
[^ ]
Match any one character not listed between the brackets

grep [^cn]ord sample.txt
Will match “lord”, “2ord”, etc. but not “cord” or “nord”

grep [a-zA-Z]ord sample.txt
Will match “aord”, “bord”, “Aord”, “Bord”, etc.

grep [^0-9]ord sample.txt
Will match “Aord”, “aord”, etc. but not “2ord”, etc.

重复操作符
重复操作符,或数量词,都描述了查找一个特定字符的次数。它们常被用于字符匹配语法以查找多行的字符,可参见表B。

Table B: Regular expression repetition operators
格式说明:
---------------
操作:
解释:
例子:
结果:
----------------
?
Match any character one time, if it exists
egrep “?erd” sample.txt
Will match “berd”, “herd”, etc. and “erd”
------------------
*
Match declared element multiple times, if it exists
egrep “n.*rd” sample.txt
Will match “nerd”, “nrd”, “neard”, etc.
-------------------
+
Match declared element one or more times
egrep “[n]+erd” sample.txt
Will match “nerd”, “nnerd”, etc., but not “erd”
--------------------
{n}
Match declared element exactly n times
egrep “[a-z]{2}erd” sample.txt
Will match “cherd”, “blerd”, etc. but not “nerd”, “erd”, “buzzerd”, etc.
------------------------
{n,}
Match declared element at least n times
egrep “.{2,}erd” sample.txt
Will match “cherd” and “buzzerd”, but not “nerd”
------------------------
{n,N}
Match declared element at least n times, but not more than N times
egrep “n[e]{1,2}rd” sample.txt
Will match “nerd” and “neerd”

第三部分:
----------------
锚
锚是指它所要匹配的格式,如图C所示。使用它能方便你查找通用字符的合并。例如,我用vi行编辑器命令:s来代表substitute,这一命令的基本语法是:

s/pattern_to_match/pattern_to_substitute/


Table C: Regular expression anchors
-------------
操作
解释
例子
结果
---------------
^
Match at the beginning of a line
s/^/blah /
Inserts “blah “ at the beginning of the line
---------------
$
Match at the end of a line
s/$/ blah/
Inserts “ blah” at the end of the line
---------------
/<
Match at the beginning of a word
s//Inserts “blah” at the beginning of the word

egrep “/Matches “blahfield”, etc.
------------------
/>
Match at the end of a word
s//>/blah/
Inserts “blah” at the end of the word

egrep “/>blah” sample.txt
Matches “soupblah”, etc.
---------------
/b
Match at the beginning or end of a word
egrep “/bblah” sample.txt
Matches “blahcake” and “countblah”
-----------------
/B
Match in the middle of a word
egrep “/Bblah” sample.txt
Matches “sublahper”, etc.

间隔

Res中的另一可便之处是间隔(或插入)符号。实际上,这一符号相当于一个OR语句并代表|符号。下面的语句返回文件sample.txt中的“nerd” 和 “merd”的句柄:

egrep “(n|m)erd” sample.txt

间隔功能非常强大,特别是当你寻找文件不同拼写的时候,但你可以在下面的例子得到相同的结果:

egrep “[nm]erd” sample.txt

当你使用间隔功能与Res的高级特性连接在一起时,它的真正用处更能体现出来。


第四部分:
----------------
一些保留字符
Res的最后一个最重要特性是保留字符(也称特定字符)。例如,如果你想要查找“ne*rd”和“ni*rd”的字符,格式匹配语句“n[ei]*rd”与“neeeeerd” 和 “nieieierd”相符合,但并不是你要查找的字符。因为‘*’(星号)是个保留字符,你必须用一个反斜线符号来替代它,即:“n[ei]/*rd”。其它的保留字符包括:

^ (carat)
. (period)
[ (left bracket}
$ (dollar sign)
( (left parenthesis)
) (right parenthesis)
| (pipe)
* (asterisk)
+ (plus symbol)
? (question mark)
{ (left curly bracket, or left brace)
/ backslash
一旦你把以上这些字符包括在你的字符搜索中,毫无疑问Res变得非常的难读。比如说以下的PHP中的eregi搜索引擎代码就很难读了。

eregi("^[_a-z0-9-]+(/.[_a-z0-9-]+)*@[a-z0-9-]+(/.[a-z0-9-]+)*$",$sendto)

你可以看到,程序的意图很难把握。但如果你抛开保留字符,你常常会错误地理解代码的意思。

总结
在本文中,我们揭开了正则表达式的神秘面纱,并列出了ERE标准的通用语法。如果你想阅览Open Group组织的规则的完整描述,你可以参见:Regular Expressions,欢迎你在其中的讨论区发表你的问题或观点。


另外一篇文章
----------------------------------------
正则表达式和Java编程语言
-----------------------------------------
类和方法

下面的类根据正则表达式指定的模式,与字符序列进行匹配。

Pattern类

Pattern类的实例表示以字符串形式指定的正则表达式,其语 法类似于Perl所用的语法。

用字符串形式指定的正则表达式,必须先编译成Pattern类的 实例。生成的模式用于创建Matcher对象,它根据正则表达式与任 意字符序列进行匹配。多个匹配器可以共享一个模式,因为它是非专属的。

用compile方法把给定的正则表达式编译成模式,然后用 matcher方法创建一个匹配器,这个匹配器将根据此模式对给定输 入进行匹配。pattern 方法可返回编译这个模式所用的正则表达 式。

split方法是一种方便的方法,它在与此模式匹配的位置将给 定输入序列切分开。下面的例子演示了:

/*
* 用split对以逗号和/或空格分隔的输入字符串进行切分。
*/
import java.util.regex.*;

public class Splitter {
public static void main(String[] args) throws Exception {
// Create a pattern to match breaks
Pattern p = Pattern.compile("[,//s]+");
// Split input with the pattern
String[] result =
?? p.split("one,two, three four , five");
for (int i=0; iSystem.out.println(result[i]);
}
}

Matcher类

Matcher类的实例用于根据给定的字符串序列模式,对字符序 列进行匹配。使用CharSequence接口把输入提供给匹配器,以便 支持来自多种多样输入源的字符的匹配。

通过调用某个模式的matcher方法,从这个模式生成匹配器。 匹配器创建之后,就可以用它来执行三类不同的匹配操作:

matches方法试图根据此模式,对整个输入序列进行匹配。
lookingAt方法试图根据此模式,从开始处对输入序列进 行匹配。
find方法将扫描输入序列,寻找下一个与模式匹配的地方。

这些方法都会返回一个表示成功或失败的布尔值。如果匹配成功,通过查询 匹配器的状态,可以获得更多的信息

这个类还定义了用新字符串替换匹配序列的方法,这些字符串的内容如果需 要的话,可以从匹配结果推算得出。

appendReplacement方法先添加字符串中从当前位置到下一个 匹配位置之间的所有字符,然后添加替换值。appendTail添加的 是字符串中从最后一次匹配的位置之后开始,直到结尾的部分。

例如,在字符串blahcatblahcatblah中,第一个 appendReplacement添加blahdog。第二个 appendReplacement添加blahdog,然后 appendTail添加blah,就生成了: blahdogblahdogblah。请参见示例 简单的单词替换。

CharSequence接口

CharSequence接口为许多不同类型的字符序列提供了统一的只 读访问。你提供要从不同来源搜索的数据。用String, StringBuffer 和CharBuffer实现CharSequence,,这样就可以很 容易地从它们那里获得要搜索的数据。如果这些可用数据源没一个合适的,你可 以通过实现CharSequence接口,编写你自己的输入源。

Regex情景范例

以下代码范例演示了java.util.regex软件包在各种常见情形 下的用法:

简单的单词替换

/*
* This code writes "One dog, two dogs in the yard."
* to the standard-output stream:
*/
import java.util.regex.*;

public class Replacement {
public static void main(String[] args)
?????? throws Exception {
// Create a pattern to match cat
Pattern p = Pattern.compile("cat");
// Create a matcher with an input string
Matcher m = p.matcher("one cat," +
???? " two cats in the yard");
StringBuffer sb = new StringBuffer();
boolean result = m.find();
// Loop through and create a new String
// with the replacements
while(result) {
m.appendReplacement(sb, "dog");
result = m.find();
}
// Add the last segment of input to
// the new String
m.appendTail(sb);
System.out.println(sb.toString());
}
}

电子邮件确认

以下代码是这样一个例子:你可以检查一些字符是不是一个电子邮件地址。 它并不是一个完整的、适用于所有可能情形的电子邮件确认程序,但是可以在 需要时加上它。

/*
* Checks for invalid characters
* in email addresses
*/
public class EmailValidation {
public static void main(String[] args)
?????????? throws Exception {
??????????
String input = "@sun.com";
//Checks for email addresses starting with
//inappropriate symbols like dots or @ signs.
Pattern p = Pattern.compile("^//.|^//@");
Matcher m = p.matcher(input);
if (m.find())
System.err.println("Email addresses don't start" +
????????" with dots or @ signs.");
//Checks for email addresses that start with
//www. and prints a message if it does.
p = Pattern.compile("^www//.");
m = p.matcher(input);
if (m.find()) {
System.out.println("Email addresses don't start" +
??" with /"www./", only web pages do.");
}
p = Pattern.compile("[^A-Za-z0-9//.//@_//-~#]+");
m = p.matcher(input);
StringBuffer sb = new StringBuffer();
boolean result = m.find();
boolean deletedIllegalChars = false;

while(result) {
deletedIllegalChars = true;
m.appendReplacement(sb, "");
result = m.find();
}

// Add the last segment of input to the new String
m.appendTail(sb);

input = sb.toString();

if (deletedIllegalChars) {
System.out.println("It contained incorrect characters" +
?????? " , such as spaces or commas.");
}
}
}

从文件中删除控制字符

/* This class removes control characters from a named
* file.
*/
import java.util.regex.*;
import java.io.*;

public class Control {
public static void main(String[] args)
?????????? throws Exception {
??????????
//Create a file object with the file name
//in the argument:
File fin = new File("fileName1");
File fout = new File("fileName2");
//Open and input and output stream
FileInputStream fis =
?????? new FileInputStream(fin);
FileOutputStream fos =
??????new FileOutputStream(fout);

BufferedReader in = new BufferedReader(
???? new InputStreamReader(fis));
BufferedWriter out = new BufferedWriter(
???? new OutputStreamWriter(fos));

// The pattern matches control characters
Pattern p = Pattern.compile("{cntrl}");
Matcher m = p.matcher("");
String aLine = null;
while((aLine = in.readLine()) != null) {
m.reset(aLine);
//Replaces control characters with an empty
//string.
String result = m.replaceAll("");
out.write(result);
out.newLine();
}
in.close();
out.close();
}
}

文件查找

/*
* Prints out the comments found in a .java file.
*/
import java.util.regex.*;
import java.io.*;
import java.nio.*;
import java.nio.charset.*;
import java.nio.channels.*;

public class CharBufferExample {
public static void main(String[] args) throws Exception {
// Create a pattern to match comments
Pattern p =
Pattern.compile("//.*$", Pattern.MULTILINE);

// Get a Channel for the source file
File f = new File("Replacement.java");
FileInputStream fis = new FileInputStream(f);
FileChannel fc = fis.getChannel();

// Get a CharBuffer from the source file
ByteBuffer bb =
fc.map(FileChannel.MAP_RO, 0, (int)fc.size());
Charset cs = Charset.forName("8859_1");
CharsetDecoder cd = cs.newDecoder();
CharBuffer cb = cd.decode(bb);

// Run some matches
Matcher m = p.matcher(cb);
while (m.find())
System.out.println("Found comment: "+m.group());
}
}

结论
现在Java编程语言中的模式匹配和许多其他编程语言一样灵活了。可以在应 用程序中使用正则表达式,确保数据在输入数据库或发送给应用程序其他部分之 前,格式是正确的,正则表达式还可以用于各种各样的管理性工作。简而言之, 在Java编程中,可以在任何需要模式匹配的地方使用正则表达式。


JDK1.4之正規表示式
written by william chen(06/19/2002)

--------------------------------------------------------------------------------

什麼是正規表示式呢(Reqular Expressions)

就是針對檔案、字串,透過一種很特別的表示式來作search與replace

因為在unix上有很多系統設定都是存放在文字檔中,因此網管或程式設計常常需要作搜尋與取代

所以發展出一種特殊的命令叫做正規表示式

我們可以很簡單的用 "s/
因此jdk1.4提供了一組正規表示式的package供大家使用

若是jdk1.4以下的可以到http://jakarta.apache.org/oro取得相關功能的package

剛剛列出的一串符號" s/
適用於j2sdk1.4的正規語法

"." 代表任何字元

正規式 原字串 符合之字串
. ab a
.. abc ab

"+" 代表一個或以個以上的字元
"*" 代表零個或是零個以上的字元

正規式 原字串 符合之字串
+ ab ab
* abc abc

"( )"群組

正規式 原字串 符合之字串
(ab)* aabab abab

字元類

正規式 原字串 符合之字串
[a-dA-D0-9]* abczA0 abcA0
[^a-d]* abe0 e0
[a-d]* abcdefgh abab


簡式

/d 等於 [0-9] 數字
/D 等於 [^0-9] 非數字
/s 等於 [ /t/n/x0B/f/r] 空白字元
/S 等於 [^ /t/n/x0B/f/r] 非空白字元
/w 等於 [a-zA-Z_0-9] 數字或是英文字
/W 等於 [^a-zA-Z_0-9] 非數字與英文字

每一行的開頭或結尾

^ 表示每行的開頭
$ 表示每行的結尾

--------------------------------------------------------------------------------

正規表示式 java.util.regex 相關的類別

Pattern—正規表示式的類別
Matcher—經過正規化的結果
PatternSyntaxExpression—Exception thrown while attempting to compile a regular expression

範例1: 將字串中所有符合"<"的字元取代成"lt;"

import java.io.*;
import java.util.regex.*;
/**
* 將字串中所有符合"<"的字元取代成"lt;"
*/
public static void replace01(){
// BufferedReader lets us read line-by-line
Reader r = new InputStreamReader( System.in );
BufferedReader br = new BufferedReader( r );
Pattern pattern = Pattern.compile( "<" ); // 搜尋某字串所有符合'<'的字元
try{
while (true) {
String line = br.readLine();
// Null line means input is exhausted
if (line==null)
break;
Matcher a = pattern.matcher(line);
while(a.find()){
System.out.println("搜尋到的字元是" + a.group());
}
System.out.println(a.replaceAll("lt;"));// 將所有符合字元取代成lt;
}
}catch(Exception ex){ex.printStackTrace();};
}

範例2:

import java.io.*;
import java.util.regex.*;
/**
* 類似StringTokenizer的功能
* 將字串以","分隔然後比對哪個token最長
*/
public static void search01(){
// BufferedReader lets us read line-by-line
Reader r = new InputStreamReader( System.in );
BufferedReader br = new BufferedReader( r );
Pattern pattern = Pattern.compile( ",//s*" );// 搜尋某字串所有","的字元
try{
while (true) {
String line = br.readLine();
String words[] = pattern.split(line);
// Null line means input is exhausted
if (line==null)
break;
// -1 means we haven't found a word yet
int longest=-1;
int longestLength=0;
for (int i=0; iSystem.out.println("分段:" + words[i] );
if (words[i].length() > longestLength) {
longest = i;
longestLength = words[i].length();
}
}
System.out.println( "長度最長為:" + words[longest] );
}
}catch(Exception ex){ex.printStackTrace();};
}

--------------------------------------------------------------------------------

其他的正規語法

/^/s* # 忽略每行開始的空白字元
(M(s|r|rs)/.) # 符合 Ms., Mrs., and Mr. (titles)

OPTEE常见13类问题与解答 OPTEE常见13类问题并解答 阅读详情

相关推荐

Windows Server远程桌面断开后,PyWinAuto/按键精灵脚本失效?试试这个‘会话保持’的终极配置

本文深入解析Windows Server远程桌面断开后导致PyWinAuto/按键精灵脚本失效的问题,提供会话保持的终极配置方案。通过转换到控制台会话(console模式)和调整组策略,确保自动化程序在断开连接后持续稳定运行,适用于Windows Server各版本。

weixin_28738165的博客 235

学习正则表达式 - 选择、分组和向后引用

选择操作、选项和修饰符、统计单词出现的行数、子模式、捕获分组和后向引用、命名分组、非捕获分组、原子分组、回溯

wzy0623的专栏 1572

CODESYS Softmotion(一)功能介绍

一、CODESYS SoftMotion RTE SL产品 1.1 CODESYS Runtime SL 产品家族介绍 目前支持的主流厂商的硬件产品,让部署在上面的成为实时设备。 对于Windows系统,根据需求选择对应的Runtime: RTE极大的提高了实时性,适合进行运动控制,同时RTE还支持了多个主从站协议: 还可以选择可选的功能(Single License): RTE对硬件和系统有要求,如果你需要硬件功能,那么网卡会有最低要求。 1.2 RTE的下载和安装 在官网http://codes

Fishfishfishfishcat 2万+

正则表达式 ----选择匹配符

一、选择匹配符 在匹配某个字符串的时候是选择性的,既可以匹配这个,也可以匹配那个。 package com.jun.regexp; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * 选择匹配符 */ public class RogEX04 { public static void main(String[] args) { String content="zhengyabo 波

qq_46093575的博客 1184

Android应用加固脱壳实战:从爱加密原理到Frida内存Dump与修复

在移动应用安全领域,代码加固与动态加载是保护核心逻辑的关键技术。其原理在于通过修改应用启动流程,将原始DEX加密隐藏,并注入包含解密逻辑的壳DEX,实现运行时动态加载。这项技术的核心价值在于防止应用被逆向分析、二次打包或恶意篡改,广泛应用于金融、游戏等高安全要求场景。对于安全研究、漏洞挖掘或历史版本审计,掌握脱壳技能至关重要。本文聚焦于**爱加密**等主流加固方案,深入探讨如何利用**Frida**框架在内存中精准捕获解密后的DEX数据,并解决脱壳后常见的签名校验等运行问题,提供一套从原理到实践的完整攻防思

weixin_28716443的博客 509

小波变换(Wavelet Transform)原理及介绍

小波变换是一种多分辨率时频分析工具,克服了傅里叶变换无法定位时间信息的缺陷。通过可伸缩平移的母小波,它能同时捕捉信号的高频细节(短时特征)和低频轮廓(整体趋势)。其核心原理是利用不同尺度的小波基与信号进行内积运算,生成时频域系数矩阵。小波变换具有动态分辨率特性,高频部分时间精度高,低频部分频率分辨率好。主要应用包括瞬态事件检测、信号降噪、数据压缩(如JPEG2000)和压缩感知(如快速MRI)。

qq_42758052的博客 5514

正则表达式学习笔记(一)——使用正则表达式的分析方法

一、使用正则表达式的分析方法 1、用自然语言来表达和说明你的意图 2、考虑数据源及其可能的内容 3、考虑可以使用的正则表达式选项 4、考虑灵敏度和特殊性 5、创建适当的正则表达式 6、对除了简单的正则表达式之外的正则表达式给予说明 7、使用空白区域保持正则表达式说明的清晰 8、测试正则表达式结果 1、使用自然语言来表达和说明你的意图 在人类设计的任何规划工作中,对需

王慧龙的专栏 1099

5分钟搞定!用扣子空间LinkReaderPlugin快速搭建网页内容抓取机器人(附Python复现代码)

本文详细介绍了如何利用扣子空间的LinkReaderPlugin快速搭建网页内容抓取机器人,仅需5分钟即可完成配置。通过Python复现代码和可视化工作流,开发者可以轻松实现智能网页抓取,提升数据采集效率。文章还探讨了与RAG工作流的集成方案及性能优化技巧,适用于金融监控、电商追踪等多种场景。

study的专栏 1098

常用正则表达式最强整理

一、校验数字的表达式 数字:^[0-9]*$ n位的数字:^\d{n}$ 至少n位的数字:^\d{n,}$ m-n位的数字:^\d{m,n}$ 零和非零开头的数字:^(0|[1-9][0-9]*)$ 非零开头的最多带两位小数的数字:^([1-9][0-9]*)+(.[0-9]{1,2})?$ 带1-2位小数的正数或负数:^(\-)?\d+(\.\d{1,2})?$ 正数、负数、和小数:^(\-|\+)?\d+(\.\d+)?$

窦再兴的博客 2049

open-web UI 实用指南

open-web UI 类似于chatgpt的界面,可以私有化模型本地部署,也可以用商业模型.本文只是用开源模型. 它以实现多模态AI聊天 , AI 翻译 , 语音转文本, 文本转语音, 文生图,代码助手,可谓利器。

szmars的博客 3万+

如何利用air780e与stm32c8c6进行通信实现给手机发送一条英文短信的功能?

🏆 本文收录于《全栈Bug调优(实战版)》专栏,致力于分享我在项目实战过程中遇到的各类Bug及其原因,并提供切实有效的解决方案。无论你是初学者还是经验丰富的开发者,本文将为你指引出一条更高效的Bug修复之路,助你早日登顶,迈向财富自由的梦想🚀!同时,欢迎大家关注、收藏、订阅本专栏,更多精彩内容正在持续更新中。让我们一起进步,Up!Up!Up!    备注: 部分问题/难题源自互联网,经过精心筛选和整理,结合数位十多年大厂实战经验资深大佬经验总结所得,数条可行方案供所需之人参考。

**My Coding Family** 1261

正则表达式(9):扩展正则表达式

上图中的扩展正则使用了分组符号”( )”,”(com|net)”表示将括号内的内容看做一个整体,而括号内的内容为”com|net”,它表示”com或者net”,所以,”(com|net)$”就表示以com或者net结尾的行。上图中,grep命令使用了”-E”选项,表示grep命令会把”正则表达式”中的符号当成”扩展正则表达式”去理解,而不再使用默认的”基本正则表达式”。5、顶级域名之前必须包含一个”点”,换句话说就是,邮箱必须以”.com”、”.net”、”.org”、”.edu”结尾。

qq_40531442的博客 2189

精读204页华为的流程管理(文末附下载链接)

链接:https://pan.baidu.com/s/1eEwdBR5c0PIxkOrNhDZcGg?pwd=wha2 提取码:wha2 复制这段内容后打开百度网盘手机App,操作更方便哦。,以提升企业运营效率和竞争力,同时解决了诸多业务痛点,为华为的全球化发展提供了有力支撑。华为的流程管理对其发展起着关键作用,通过构建完善的流程体系,提升了企业运营效率与竞争力。华为的流程管理在企业发展中至关重要,其围绕。,并通过流程变革不断优化。在流程管理过程中,强调。构建了全面的流程体系。

cdfunlove的博客 290

Python正则表达式

正则表达式是对字符串提取的一套规则,我们把这个规则用正则里面的特定语法表达出来,去匹配满足这个规则的字符串。正则表达式具有通用型,不仅python里面可以用,其他的语言也一样适用。正则表达式是一个特殊的字符序列,它能帮助你方便的检查一个字符串是否与某种模式匹配,常用的有都可以用于匹配字符串。

2301_81704383的博客 1340

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

linux正则表达式,正则表达式分类,元字符,基础正则表达式,扩展正则表达式,正则表达式案例

上文介绍了通配符1,本文介绍、总结和通配符有着诸多共同点的一类符号,即正则表达式(regular expression)。只是通配符的对象是文件、或目录,而后者对象是文本内容。在很多地方都有正则表达式的身影,它的作用是用来匹配指定式样的内容,个人理解为,正则表达式规定了指定式样pattern,能匹配该指定式样的字符或字符串即为内容,内容的来源可以是文件、某个标准输入等,使用正则表达式(regular expression)的目的就是匹配到了该内容。

有人说学习`这个`最好的时间是十年前,有人说最好的时间是现在,众说纷纭... 1829

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

shell 正则表达式详解

什么是正则表达式;为什么使用正则表达式;如何使用正则表达式;基本正则表达式;扩展正则表达式; 包含正则表达式例题。

weixin_48814356的博客 3004

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

linux正则表达式大全,正则表达式,正则表达式语法大全

正则表达式,正则表达式语法大全正则表达式分为两类:基本正则表达式:BRE扩展正则表达式:ERE基本正则表达式的元字符:字符匹配:.: 匹配任意单个字符;[]: 匹配指定范围内的任意单个字符[^]:匹配指定范围外的任意单个字符[:digit:],[:upper:],[:lower:],[:alpha:],[:alnum:],[:space:],[:punct:]匹配次数:用在要指定次数的字符后面,...

weixin_32955259的博客 2882

regex 正则表达式

regex 正则表达式 文章目录regex 正则表达式前言元字符abc 等普通字符| 符号两侧的正则均能匹配. 匹配任意一个字符 '\n'除外^ 匹配字符串开头$ 匹配字符串结尾* 匹配重复0次或多次+ 匹配重复1次或多次? 匹配重复0次或1次{N} 匹配重复指定次数{M,N} 匹配重复指定次数范围[abcd] 字符集匹配[^ ...] 字符集不匹配\d 匹配任意数字字符\D 匹配任意非数字字...

weixin_40118971的博客 6476

【正则表达式】{1} ——正则表达式的语法

参考资料:Python网络爬虫与信息提取(北京理工大学慕课) 正则表达式的语法: 正则表达式语法由字符和操作符构成 正则表达式的常用操作符: 操作符 说明 实例 . 表示任何单个字符 [ ] 字符集,对单个字符给出取值范围 [abc]表示a、b、c,[a-z]表示a到z单个字符 [^ ] 非字符集,对单个字符给出排除范围 [^abc]表示非a或b或c的单个字符 ...

Giyn 4789

正则表达式总结

每次使用到正则表达式的时候都要去翻书或者去网上查,很麻烦,抽出点时间做一个总结,方便以后用到的时候查阅。一、正则表达式的几个特殊符号1、^和$两个特殊的符号‘^’和’$’。他们的作用是分别指出一个字符串的开始和结束。例子如下:"^The":表示所有以"The"开始的字符串("There","The cat"等); "of despair$":表示所以以"of despair"结尾的字符串; "^ab

lmb55的专栏 2275
下一篇: 关于AnsiSting的使用大全(转自ChinaBCB)
duduwolf
博客等级 码龄25年 17粉丝 52原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址