Regular expressions in makefiles

Hi, I am learning about the px4 framework. When reading the makefile, there are two regular expressions in it that make me a little confused.


RESULT = $(shell [ -f .github/workflows/compile_${1}.yml ] && cat .github/workflows/compile_${1}.yml | sed -E 's|[[:space:]]+(.*),|check_\1|g' | grep check_${2})

j := $(shell ps T | sed -n 's|.*$(MAKE_PID).*$(MAKE).* \(-j\|--jobs\) *\([0-9][0-9]*\).*|\2|p')

My question is:

  1. I studied the sed command on google, and learned that the sed command uses \ separator in script to separate different parts such as: s\xxxx\xxxxx\g. But in the first expression, it uses |.

  2. In the second expression, the ragular expression uses \( xxx \) as the capture group brackets instead of (xxxx)

When I run make xxx, it works well. That makes me confused.

I run make -j16 -n, j is null. So I changed the expression as:
$(shell ps T | sed -r -n 's|.*$(MAKE_PID).*$(MAKE).* (-j\|--jobs) *([0-9][0-9]*).*|\2|p')")
The result changed to 16.