The internals of the exercise
package are not well designed for this and need some patching to print custom counters correctly in all situations (the heading of the Exercise, the entry in the list of exercises and in any cross references). Here is such a collection of patches in a test document.
\documentclass{article}
\usepackage{etoolbox}
\usepackage[lastexercise]{exercise}
\newcounter{pbone}[section]
\renewcommand*{\thepbone}{\thesection.\arabic{pbone}}
\renewcommand{\theExercise}{\arabic{Exercise}}
\makeatletter
\patchcmd{\@@@ExeEnv}{\theExercise}%
{\csname the\@ExerciseCounter\endcsname}{}{Failed}
\patchcmd{\@@@ExeEnv}{\addcontentsline}%
{\if@ExeStared\else\addcontentsline}{}{Failed}
\patchcmd{\@@@ExeEnv}{\endgroup}{\fi\endgroup}{}{Failed}
\renewcommand{\ExerciseHeaderNB}{\csname the\@ExerciseCounter\endcsname}
\patchcmd{\@getExerciseInfo}{\p@Exercise\theExercise}%
{\csname p@\@ExerciseCounter\endcsname
\csname the\@ExerciseCounter\endcsname}{}{Failed}
\patchcmd{\@@@ExeCmd}{\theExercise}%
{\csname the\@ExerciseCounter\endcsname}{}{Failed}
\makeatother
\begin{document}
\listofexercises
\section{A section}
Now in first section.
\begin{Exercise}
\label{ex:1}
Standard counter.
\end{Exercise}
\begin{Exercise}[counter=pbone,label=a]
\label{ex:2}
Test with custom number.
\end{Exercise}
\section{Another section}
Now in second section.
\begin{Exercise}[counter=pbone]
\label{ex:3}
Test with custom number.
\end{Exercise}
\begin{Exercise}[label=b]
\label{ex:4}
Standard exercise.
\end{Exercise}
\begin{Exercise*}
Test of star.
\end{Exercise*}
\begin{Exercise}[counter=pbone]
\label{ex:5}
Test with custom number.
\end{Exercise}
\bigbreak
Testing an exercise list wiht answers.
\bigbreak
\begin{ExerciseList}
\Exercise Simple
\Answer Hard
\Exercise[counter=pbone] Interesting
\Answer Long
\end{ExerciseList}
First~\ref{ex:1};
second~\ref{ex:2};
third~\ref{ex:3};
forth~\ref{ex:4};
fifth~\ref{ex:5}.
Label \ref{a}; label \ref{b}.
\end{document}
The main problem is that the package defines \theExercise
to do something other than just produce a printed form for the Exercise
counter. In most situations was is needed is a command producing the printed representation of the counter for this environment. The name of that counter is stored in \@ExerciseCounter
and the printed form should be accessed via a macro \the...
where ...
is that counter name; one can get this by the construct
\csname the\@ExerciseCounter\endcsname
Most of the patches above implement this, replacing instances of \theExercise
with the above code. At another point the associated macro \p@Exercise
is used and this has been patched too to adjust to the chosen counter.
Lastly the starred form Exercise*
of the environment did not behave as advertised, it produced an entry in the list of exercises, I have fixed this too via the last two patches applied to \@@@ExeEnv
.
Note that I have adjusted your definition of \thepbone
to only produces the relevant characters. The bold face formatting should only be applied when it is used in a bold context, not at every reference.