Parenthesized match using POSIX for Linux

(imported topic written by MeeWeeNg91)

Hi,

I am a POSIX idiot ! and have been working on this for pass 2 days.

I try to write a qna to assure that it output. Did i missing anything ?

Can any expert help me ?

Q: (parenthesized parts whose (it as string = “90”) of matches (regex "^PASS_MAX_DAYS

\t

*(

0-9

+)$") of it) of lines of file “/etc/login.defs”

T: 11497980

#cat /etc/login.defs | grep PASS

PASS_MAX_DAYS 90

PASS_MIN_DAYS 0

PASS_MAX_LEN 127

PASS_MIN_LEN 8

PASS_WARN_AGE 21

The PASS_MAX_DAYS and 90 is actually a tab away. But still i get no out.

Please help.

-Mee Wee

(imported comment written by BenKus)

Hi Mee Wee,

I had some issues using the “\t” character in the Unix/Linux regexp library before… I am not sure why… can you run a test and see if that is the problem?

I am not sure the solution at the moment, but I will try to check it out…

Ben

(imported comment written by MeeWeeNg91)

Hi Ben

Yes, i think it is \t or the cursor location when we check the space.

I did a test, to have the file change the spacing

PASS_MAX_DAYS[ ]90 instead of

PASS_MAX_DAYS

\t

90

It worsk if we have regex to [ ] but not the tab. As when we move the cursor between the DAYS and the 90, it started at S and TAB then a space before you reach 90.

I will continue to work on it, if you found anything. Do let me know.

Thanks

-Mee Wee

(imported comment written by BenKus)

Maybe try:

(parenthesized parts whose (it as string = “90”) of matches (regex “^PASS_MAX_DAYS.*(0-9+)$”) of it) of lines of file “/etc/login.defs”

Ben

(imported comment written by MeeWeeNg91)

Hi Ben

Yeehhhh !!! Finally i get it.

This is what i got it to work

(parenthesized parts whose (it as string = “90”) of matches (regex "^PASS_MAX_DAYS.

\t

*(

0-9

+)$") of it) of lines of file “/etc/login.defs”

Thanks for your hint. Actually we need to match .

\t

-MeeWee