我们在复制代码的时候,经常会发生这种事情。
例如:如下文件(lpc17xx_libcfg.h)
00001 /***********************************************************************/ 00020 #ifndef LPC17XX_LIBCFG_H_ 00021 #define LPC17XX_LIBCFG_H_ 00022 00023 #include "lpc_types.h" 00024 00025 00026 /************************** DEBUG MODE DEFINITIONS *********************************/ 00027 /* Un-comment the line below to compile the library in DEBUG mode, this will expanse 00028 the "CHECK_PARAM" macro in the FW library code */ 00029 00030 #define DEBUG 00031 00032 00033 /******************* PERIPHERAL FW LIBRARY CONFIGURATION DEFINITIONS ***********************/ 00034 00035 /* Comment the line below to disable the specific peripheral inclusion */ 00036 00037 /* DEBUG_FRAMWORK ------------------------------ */ 00038 //#define _DBGFWK 00039 00040 /* GPIO ------------------------------- */ 00041 #define _GPIO 00042 00043 /* EXTI ------------------------------- */ 00044 //#define _EXTI 00045 00046 /* UART ------------------------------- */ 00047 //#define _UART 00048 //#define _UART0 00049 //#define _UART1 00050 //#define _UART2 00051 //#define _UART3 00052 00053 /* SPI ------------------------------- */ 00054 //#define _SPI 00055 00056 /* SSP ------------------------------- */ 00057 //#define _SSP 00058 //#define _SSP0 00059 //#define _SSP1 00060 00061 /* SYSTICK ----------------------------*/ 00062 #define _SYSTICK 00063 00064 /* I2C ------------------------------- */ 00065 //#define _I2C 00066 //#define _I2C0 00067 //#define _I2C1 00068 //#define _I2C2 00069 00070 /* TIMER ------------------------------- */ 00071 #define _TIM 00072 00073 /* WDT ------------------------------- */ 00074 //#define _WDT 00075 00076 00077 /* GPDMA ------------------------------- */ 00078 //#define _GPDMA 00079 00080 00081 /* DAC ------------------------------- */ 00082 //#define _DAC 00083 00084 /* DAC ------------------------------- */ 00085 //#define _ADC 00086 00087 00088 /* PWM ------------------------------- */ 00089 //#define _PWM 00090 //#define _PWM1 00091 00092 /* RTC ------------------------------- */ 00093 //#define _RTC 00094 00095 /* I2S ------------------------------- */ 00096 //#define _I2S 00097 00098 /* USB device ------------------------------- */ 00099 //#define _USBDEV 00100 //#define _USB_DMA 00101 00102 /* QEI ------------------------------- */ 00103 //#define _QEI 00104 00105 /* MCPWM ------------------------------- */ 00106 //#define _MCPWM 00107 00108 /* CAN--------------------------------*/ 00109 //#define _CAN 00110 00111 /* RIT ------------------------------- */ 00112 #define _RIT 00113 00114 /* EMAC ------------------------------ */ 00115 //#define _EMAC 00116 00117 /************************** GLOBAL/PUBLIC MACRO DEFINITIONS *********************************/ 00118 00119 #ifdef DEBUG 00120 /******************************************************************************* 00121 * @brief The CHECK_PARAM macro is used for function's parameters check. 00122 * It is used only if the library is compiled in DEBUG mode. 00123 * @param[in] expr - If expr is false, it calls check_failed() function 00124 * which reports the name of the source file and the source 00125 * line number of the call that failed. 00126 * - If expr is true, it returns no value. 00127 * @return None 00128 *******************************************************************************/ 00129 #define CHECK_PARAM(expr) ((expr) ? (void)0 : check_failed((uint8_t *)__FILE__, __LINE__)) 00130 #else 00131 #define CHECK_PARAM(expr) 00132 #endif /* DEBUG */ 00133 00134 00135 00136 /************************** GLOBAL/PUBLIC FUNCTION DECLARATION *********************************/ 00137 00138 #ifdef DEBUG 00139 void check_failed(uint8_t *file, uint32_t line); 00140 #endif 00141 00142 00143 #endif /* LPC17XX_LIBCFG_H_ */
首先,我们要选择正则表达式选项
然后,替换行号
?:表示任何的单个字符。
最后,替换掉行首的空格