Can you please tell me how to rewrite this search method in Java?
var reg = string.Format(".*({0}).*", texbox.Text); Regex any = new Regex(reg); var mf = a.Split('\n'); textblock.Text = string.Empty; foreach (var f in mf) if (any.IsMatch(f)) textblock.Text += f + Environment.NewLine; Here is my option
String reg = String.format(".*%S.*", Pattern.quote(edittext.getText().toString())); Pattern any = Pattern.compile(reg); String[] mf = str_data.split("\n"); textview.setText(""); for (String f : mf) { if (any.matcher(f).matches()) { textview.append(f + "\n"); } } But the result is not displayed. Looks like a mistake in the condition. I have no idea how to write it is equivalent to the code on the Sharpe.
".*({0}).*"=>".*(%S).*"Otherwise, everything seems fine - rdorn