java code
package om.cmd.usr.define;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class TestCmd {
public static void main(String[] args){
String cmd = "om wait 10s";
if ( cmd.matches( "om .*")) {
if ( cmd.matches( "om wait .*")) {
Pattern p=Pattern. compile("(?<=om wait )([0-9]*)(?=s)");
Matcher m= p.matcher( cmd);
while( m.find()){
// result : 10
System. out.println( "result: " + m.group());
}
System. out.println( "over");
}
}
}
}
# end
c code
#include <stdio.sh>
void main(char * args){
printf("hello world : %s","zhouzhiping");
}
// end
bash code
#!/bin/bash
for line in `ls`
do
echo "$line"
done
python code
import os
Class Test():
def __init__(self):
pass
def test(self):
print "hello world"
结束!