English 中文(简体)
在正正则表达式中粘贴
原标题:Stuck in regular expression

我有3个字符串, 包含 2 字段和 2 个值 。 我需要字符串的正则表达式, 这样我才能获得数据 。 下面是 3 个字符串 :

TTextRecordByLanguage{Text=Enter here the amount to transfer from your compulsory book saving account to your compulsory checking account; Id=55; }

TTextRecordByLanguage{Text=Hello World, CaribPayActivity!; Id=2; }

TTextRecordByLanguage{Text=(iphone); Id=4; }

这两个字段是 Text >Id ,所以我需要一个表达式,在 Text 字段和分号(; )之间获取数据。确保包含特殊符号和任何数据。

<强 > 更新 *

我尝试过...

Pattern pinPattern = Pattern.compile("Text=([a-zA-Z0-9 \E]*);");
                        ArrayList<String> pins = new ArrayList<String>();
                        Matcher m = pinPattern.matcher(soapObject.toString());
                        while (m.find()) {
                            pins.add(m.group(1));
                            s[i] = m.group(1);
                            
                        }
                        Log.i("TAG", "ARRAY=>"+ s[i]);
最佳回答

我建议像这样的RE:

Text=.*?;

例如: 返回最后一个字符串

文本=( 手机);

然后您可以删除 < 坚固> Text @ / 坚固 > 和 < 坚固 > ; 从字符串中删除, 因为您只想要内容 。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签