Hello how does java and regex group work. For ex. I want to match any text 'something', the way I'd match this is .+\s+'(.+)'{1}, how can I replace any text 'something' with something?
Meaning replace matched string with 1st matched group.
If you just want to remove the single quotes, the following will work.
yourString.replaceAll("'([^']+)'", "$1");
That will search for 2 quotes with text in between. And replace it with only the text.
System.out.println("any text 'something'".replaceAll("'([^']+)'", "$1"));
Prints any text something
{1}is redundant --{1}is implied on every atom.ABCXYZ, exact desired outputABC123or whatever.{1}is also only checking for a single'which is not likely what the OP intended.'already does exactly that.'is equivalent to'{1}. And{1}applied anywhere on a regex is meaningless and redundant, since it will never modify any regex's behavior.