寻找与所有系数和指数匹配的多项式的java正则表达式

问题描述

我找到了一些代码,但没有什么能符合我的目的 我想要这个字符串

df['user_type'] = df['tags'].apply(lambda x: x.split(':')[1] if 'user_type' in x else np.nan)
df['session_type'] = df['tags'].apply(lambda x: x.split(':')[1] if 'session_type' in x else np.nan)

像这样匹配

String input = "2x^4-3x^-5+4x+3";

系数:2 -3 4 3 指数:4 -5 1 0

我发现了这个while (m.find()) { System.out.println("Coef: " + m.group(1)); System.out.println("Exponent: " + m.group(2)); } 但不匹配系数 Pattern p = Pattern.compile( "(-?\\b\\d+)[xX]\\^(-?\\d+\\b)" ); 或指数 4 3

的最后 2 个值

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)