Loading...

IntelliJ Regular Expression editor support

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

IntelliJ has the capability to use regular expressions to find and replace text source. This powerful feature simplifies your life.

In this example text from a CLI console is taken:

> mbeans 'jboss.as:subsystem=transactions' select *
jboss.as:subsystem=transactions
-------------------------------
  jdbcCommunicationStoreDropTable: false
  relativeTo: jboss.server.data.dir
  processIdUuid: true
  numberOfNestedTransactions: 0
  socketBinding: txn-recovery-environment
  numberOfTimedOutTransactions: 0
  jts: false
  numberOfTransactions: 569
  objectStorePath: tx-object-store
  jdbcActionStoreDropTable: false
  path: var
  numberOfHeuristics: 21
  numberOfCommittedTransactions: 544
  processIdSocketBinding: null
  defaultTimeout: 300
  useJdbcStore: false
  numberOfAbortedTransactions: 25
  jdbcStateStoreTablePrefix: null
  processIdSocketMaxPorts: 10
  jdbcActionStoreTablePrefix: null
  useHornetqStore: false
  hornetqStoreEnableAsyncIo: false
  jdbcStateStoreDropTable: false
  numberOfInflightTransactions: 0
  recoveryListener: false
  jdbcStoreDatasource: null
  statusSocketBinding: txn-status-manager
  jdbcCommunicationStoreTablePrefix: null
  numberOfApplicationRollbacks: 25
  nodeIdentifier: 1
  enableTsmStatus: false
  objectStoreRelativeTo: jboss.server.data.dir
  enableStatistics: true
  numberOfResourceRollbacks: 0

To use the fields values in an XML config file, simply paste the content and the regex does the matching for you. The pattern detects the values with the new line and replaces them with the comma separator.

Please remember the terms for blog comments.