can someone help me writing single regex to get module(s) from python source line?
from abc.lmn import pqr
from abc.lmn import pqr as xyz
import abc
import abc as xyz
it has 3 sub parts in it
[from(\s)<module>(\s)] --> get module if this part exist
import(\s)<module> --> get module
[(\s)as(\s)<alias>] --> ignore if this part exist
something like this
:?[from(\s)<module>(\s)]import(\s)<module>:?[(\s)as(\s)<alias>]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With