regex - How to build a Java regular expression pattern using variables -


Edit to help clarify the request:

I need to create a Java Regular Expression pattern It contains three elements; A Reggex string was added with an integer variable with the end of the Regex string.

Example HTML:

  & lt; Div class = "page" & gt; 1 & lt; / Div & gt; & Lt; Div class = "listItem" & gt; & Lt; A href = "this is / a-dummy-url-extension" & gt;   

I developed regedx patterns:

  int page = 1; Pattern p = Pattern.compile ("Page \" & gt; "+ Page +" 

Purpose: After reading the line according to the line using the methods given below, use the regex pattern to find the above HTML line.

is not working right now.

You can:

  string pattern format = "slider \ "& gt;% d & lt; / Div & gt; & Lt; Div class = \ "listItem \" & gt; & Lt; A href = \ "(. *?) \" & Gt; Pattern = Pattern.compile (string format (pattern format, 1)) Pattern = Pattern.compile (string format (pattern format, 2));    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -