You can use the java.util.regex.Pattern and java.util.regex.Matcher to solve your problem.I am posting a code snippet whose output will be any string starting with 'f' and any number of character following it.
import java.util.regex.Matcher;
import java.util.regex.Pattern;
class Test
{
public static void main(final String[] args)
{
final Pattern pattern = Pattern.compile("f(\\w+)");
final Matcher matcher = pattern.matcher("fb=1");
while (matcher.find())
{
System.out.println(matcher.group());
}
}
}