我需要完全执行此操作,但在 Android 上:
我已经尝试过此解决方案中提供的示例(适用于 Java),但没有奏效。
这就像正则表达式不起作用。
有什么解决办法吗?
谢谢!
这是我的代码:
final EditText postTextView = (EditText) findViewById(R.id.postText);
Intent output = new Intent();
String text = postTextView.getText().toString();
text = text.replaceAll("(.*://[^<>[:space:]]+[[:alnum:]/])", "<a href=\"$1\">HereWasAnURL</a>");
System.out.println("* * * Converted = " + text.replaceAll("(.*://[^<>[:space:]]+[[:alnum:]/])", "HereWasAnURL" ));
output.putExtra(ZNMainActivity.RESULT_CODE_POST, text );
setResult(RESULT_OK, output);
finish();