To validate names that can be

John, John Paul, etc.

I use this regex:

String regex = "[A-Z]([a-z]+|\\s[a-z]+)";


but when I do:

boolean ok = Pattern.matches(regex, "John Paul");


the matches fail?

Why? I want to use matches to validate the string as whole...

Is that regex wrong?


Question: Compile .tex file to a pdf on os X
Answer: The MacTeX installer makes a soft link

/usr/texbin


pointing to the directory containing the binaries relative to the current release of TeX Live (although in a somewhat indirect way). On my system, if I try ls -l /usr/texbin, I get

/usr/texbin@ -&gt; /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin


where /Library/TeX/ contains a clever set of soft links. At the end of the story, /usr/texbin points to

/usr/local/texlive/2013/bin/x86_64-darwin


If you have multiple TeX distributions (or want to switch to the universal-darwin binaries, you can use the “TeX Distribution” panel in the System Preferences application.

The MacTeX installer also adds a file called TeX in /etc/paths.d that contains the single line /usr/texbin, so that this directory will be included in the PATH environment variable.

All the above amounts to saying that you simply issue, on a Terminal window, the command

pdflatex &lt;filename&gt;


in order to compile the LaTeX file. Change the engine using xelatex or lualatex.