regex - Regular expression to get only the first word from each line -


i have text file

@sp_id      int,     @sp_name                varchar(120), @sp_gender              varchar(10), @sp_date_of_birth       varchar(10), @sp_address             varchar(120), @sp_is_active           int,  @sp_role            int 

here, want first word each line. how can this? spaces between words may space or tab etc.

here suggest:

find what: ^([^ \t]+).*

replace with: $1

explanation: ^ matches start of line, ([^ \t]+) matches 1 or more (due +) characters other space , tab (due [^ \t]), , number of characters end of line .*.

see settings:

enter image description here

in case might have leading whitespace, might want use

^\s*([^ \t]+).* 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -