How to validate output contain special string
来源:互联网 发布:rar解压缩软件下载 编辑:程序博客网 时间:2024/06/05 04:15
Problem:
1. Load a shell to running a commands, then, some strings are output
2. Validate the string contain special keywords
Like:
i want to check whether complianceserver is running or not.
Solution:
Regular
How?
1. Load system.text.regularexpression into namespace in c#
2. Get the results from shell
3. Set a regular pattern
4. Use Regex.ismatch( ) to check result.
Codes:
String ResultsStrings = myProcess.StandardOutput.Readtoend( );
String RegexPattern = "RUNNING";
/query/
Regex.Ismatch( ResultsStraings, RegexPattern, RegexOptions.Multiline);
If results contain, it will return TRUE, else return FALSE.
During the testing, i meet fail many times.
So, i doubt the Pattern is correct.
So, how to check this?
In Windows, We can use "findstr" command and in Linux/Unix, we can use "grep" to query first.
If match, we will get content of the line the matched string is in.
Format:
Findstr/grep "regexpattern" "*.txt".
- How to validate output contain special string
- how to search special string in direction
- How to find the file which contain a specified string
- how to enable sql dependency output cache
- How to convert smartform output into pdf?
- How to check others Concurrent Request Output
- How to: Enable ASP.NET Output Caching
- How to read Dalvik SIGQUIT output
- How to read Dalvik SIGQUIT output
- how to control the log4j output
- how to output quotes in bash prompt
- How to Use Output-type Variable
- How to output .ply file with RPly?
- CMFCPropertyGridCtrl: How to Validate and Update Data?
- How to bind and validate in MultiActionController
- How to find the source code of the special command?
- How to control fan speed?special for Thinkpad
- How to check a static library is built contain bitcode?
- 理解字节、字符与编码
- 较详细的介绍JNI
- Package java.lang.instrument
- android:targetSdkVersion问题。
- 推荐5个漂亮的jquery主流图表插件[转]
- How to validate output contain special string
- C++ 的内部连接(internal linkage)和外部连接(external linkage) 1--- 细节
- Hibernate初级知识学习(2)
- AllJoyn™
- ecplise 提示多導致卡的緩解方法
- 年终策划序:创业者装逼指南 v1.0
- SZNOI d001题解
- Silverlight and WebSockets
- 无法打开包括文件:“tpipv6.h”: No such file or directory