我无法理解exscript用于检测NX-OS切换提示的正则表达式
primelist.add(list_elm);
这是Python
我的提示应该是一个包含任意数字字母数字字符串的字符串,以'#'
结尾我试过'^。*#'但它没有用。字符串中没有空格或 -
有人可以帮我解决上述问题吗?
编辑:
对于您的粉丝来说,这里有一些其他类似的正则表达式,用于登录过程中识别远程操作系统可以发回的各种提示
import java.util.ArrayList;
import java.util.Iterator;
public class CreatingAThreadThree
{
private static ArrayList<String> primelist = new ArrayList<>();
static void addToList(String list_elm)
{
primelist.add(list_elm);
}
static ArrayList<String> getListReference(){
return primelist;
}
public static void main(String[] args)
{
for(long x = 6223372036854775899L; x<=(6223372036854775999L); x+=2)
{
new Thread (new MyCalcRunnable(x)).start();
}
for(long x = 9223372036854774703L; x<=9223372036854774789L; x+=2 )
{
new MyCalcThread(x, "myChildThread"+x);
}
Thread mainThread = Thread.currentThread();
int spinner =0;
char animation = ' ';
System.out.println("Total number of active threads: " + Thread.activeCount());
System.out.print("Calculating primes: ");
while(Thread.activeCount() >1)
{
spinner ++;
switch(spinner)
{
case 1:
animation = '|';
break;
case 2:
animation = '/';
break;
case 3:
animation = '-';
break;
case 4:
animation = '\\';
spinner = 0;
break;
}
System.out.print("\b" + animation);
try
{
Thread.sleep(200);
}catch(InterruptedException ex)
{
}
}
System.out.println("Total number of active threads: " + Thread.activeCount());
System.out.println("Results List:");
Iterator<?> iterator = (getListReference().iterator());
while(iterator.hasNext())
{
System.out.println(iterator.next());
}
}
}
class MyCalcThread extends Thread
{
private long numberToFactor = 0;
MyCalcThread(long numberToFactor, String name)
{
super(name);
this.numberToFactor = numberToFactor;
start();
}
@Override
public void run()
{
CreatingAThreadThree.addToList(new PrimeStuff().isItPrime(this.numberToFactor));
}
}
class MyCalcRunnable implements Runnable
{
private long numberToFactor = 0;
MyCalcRunnable(long numberToFactor)
{
this.numberToFactor = numberToFactor;
}
@Override
public void run()
{
CreatingAThreadThree.addToList(new PrimeStuff().isItPrime(this.numberToFactor));
}
}
class PrimeStuff
{
String isItPrime(long numberToFactor)
{
if(numberToFactor % 2 == 0)
return (numberToFactor +"is Not prime....divisible by 2");
long squareRoot = (long)(Math.sqrt(numberToFactor));
for(long i=3; i<squareRoot; i++)
{
if(numberToFactor % i == 0)
{
return (numberToFactor +"is Not prime....first divisible by " + i);
}
}
return (numberToFactor + " is Prime!!");
}
}