in reply to @ Regular expression:

But when I tried to print $machine_class then I got"9000" and "ia64" respectively for the above two examples.
Of course. Neither a space, nor a slash are word characters, so they aren't matched by \w
How to get the whole string?
/.*/. Add a /s modifier is the string can contain a newline.
I wanted to fetch whatever string appearing in the place of **** which keeps on changing for different instances. How to achieve that using REGEX?
/64 bit kernel 64 bit user (.*) AIX/s